public APIResult SaveExtendColumnProject(ExtendColumnProject extendColumnProject) { try { if (string.IsNullOrEmpty(extendColumnProject.ColumnName)) { return(new APIResult() { Status = false, Body = "扩展列名称不能为空" }); } masterService.SaveExtendColumnProject(extendColumnProject); return(new APIResult() { Status = true, Body = "" }); } catch (Exception ex) { return(new APIResult() { Status = false, Body = ex.Message.ToString() }); } }
public void SaveExtendColumnProject(ExtendColumnProject extendColumnProject) { ExtendColumnProject findOne = db.ExtendColumnProject.Where(x => (x.ProjectId == extendColumnProject.ProjectId && x.ColumnCode == extendColumnProject.ColumnCode)).FirstOrDefault(); if (findOne == null) { extendColumnProject.InDateTime = DateTime.Now; extendColumnProject.ModifyDateTime = DateTime.Now; db.ExtendColumnProject.Add(extendColumnProject); } else { findOne.ModifyDateTime = DateTime.Now; findOne.ModifyUserId = extendColumnProject.ModifyUserId; findOne.ColumnName = extendColumnProject.ColumnName; findOne.AddShowChk = extendColumnProject.AddShowChk; findOne.UseChk = extendColumnProject.UseChk; } db.SaveChanges(); }