修改质量接口
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace WebAPI.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 质量样板
|
||||
/// </summary>
|
||||
public class CQMSModelsController : ApiController
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据项目id获取质量样板列表集合
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="page"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ResponseData<List<Model_QualityModel>> getModelsList(string projectId, int index, int page)
|
||||
{
|
||||
ResponseData<List<Model_QualityModel>> res = new ResponseData<List<Model_QualityModel>>();
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.QualityModelService.getListDataForApi(projectId, index, page);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据id获取质量样板详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ResponseData<Model_QualityModel> GetModelsById(string id)
|
||||
{
|
||||
ResponseData<Model_QualityModel> res = new ResponseData<Model_QualityModel>();
|
||||
Model_QualityModel cd = BLL.QualityModelService.GetQualityModelById(id);
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Model_QualityModel>(cd, true);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存质量样板
|
||||
/// </summary>
|
||||
/// <param name="trainPlan"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddModels([FromBody] Model.Model_QualityModel models)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(models.QualityModelId))
|
||||
{
|
||||
models.QualityModelId = Guid.NewGuid().ToString();
|
||||
BLL.QualityModelService.AddQualityModelForApi(models);
|
||||
SaveAttachFile(models.QualityModelId, BLL.Const.QualityModelMenuId, models.AttachUrl);
|
||||
res.resultValue = models.QualityModelId;
|
||||
res.successful = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
BLL.QualityModelService.UpdateQualityModelForApi(models);
|
||||
SaveAttachFile(models.QualityModelId, BLL.Const.QualityModelMenuId, models.AttachUrl);
|
||||
res.resultValue = models.QualityModelId;
|
||||
res.successful = true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.successful = false;
|
||||
res.resultHint = e.StackTrace;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static void SaveAttachFile(string dataId, string menuId, string url)
|
||||
{
|
||||
Model.ToDoItem toDoItem = new Model.ToDoItem
|
||||
{
|
||||
MenuId = menuId,
|
||||
DataId = dataId,
|
||||
UrlStr = url,
|
||||
};
|
||||
APIUpLoadFileService.SaveAttachUrl(toDoItem);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user