using JiangSu.cs;
|
using JiangSu.Models;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Net;
|
using System.Net.Http;
|
using System.Web.Http;
|
|
namespace JiangSu.Controllers
|
{
|
public class OpController : ApiController
|
{
|
[HttpGet]
|
public Model SelectById(long id)
|
{
|
try
|
{
|
return ModelDAL.SelectById(id);
|
}
|
catch (Exception ex)
|
{
|
LogOut.Error(ex.StackTrace);
|
return null;
|
}
|
}
|
|
[HttpGet]
|
public int DeleteByIds([FromUri] List<long> ids)
|
{
|
try
|
{
|
if (null == ids || ids.Count == 0) return 0;
|
|
return ModelDAL.DeleteByIds(ids);
|
}
|
catch (Exception ex)
|
{
|
LogOut.Error(ex.StackTrace);
|
return 0;
|
}
|
}
|
|
[HttpPost]
|
public int insert([FromBody] Model model)
|
{
|
try
|
{
|
if (null == model) return 0;
|
|
return ModelDAL.insert(model);
|
}
|
catch (Exception ex)
|
{
|
LogOut.Error(ex.StackTrace);
|
return 0;
|
}
|
}
|
|
[HttpPost]
|
public int UpdateById([FromBody] Model model)
|
{
|
try
|
{
|
if (null == model) return 0;
|
|
return ModelDAL.UpdateById(model);
|
}
|
catch (Exception ex)
|
{
|
LogOut.Error(ex.StackTrace);
|
return 0;
|
}
|
}
|
}
|
}
|