public IActionResult Create(SchoolJourViewModel model) { var response = ResponseModelFactory.CreateInstance; using (_dbContext) { var entity = new SchoolJour(); entity.SchoolJourUuid = Guid.NewGuid(); entity.IsDelete = 0; entity.Headline = model.Headline; entity.SchoolUuid = model.SchoolUuid; entity.Content = model.Content; entity.Accessory = model.Accessory; entity.Digest = model.Digest; entity.AddPeople = AuthContextService.CurrentUser.DisplayName; entity.Addtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); entity.Start = "0"; entity.Tag = model.Tag; //entity.SchoolUuid = Guid.NewGuid(); _dbContext.SchoolJour.Add(entity); _dbContext.SaveChanges(); response.SetSuccess(); return(Ok(response)); } }
public IActionResult SchoolJourEdit(SchoolJourViewModel model) { var response = ResponseModelFactory.CreateInstance; if (ConfigurationManager.AppSettings.IsTrialVersion) { response.SetIsTrial(); return(Ok(response)); } using (_dbContext) { var entity = _dbContext.SchoolJour.FirstOrDefault(x => x.SchoolJourUuid == model.SchoolJourUuid); entity.Headline = model.Headline; entity.Content = model.Content; entity.Tag = model.Tag; entity.Digest = model.Digest; //entity.Addtime = model.Addtime.ToString(); entity.Accessory = model.Accessory; _dbContext.SaveChanges(); response.SetSuccess("修改成功"); return(Ok(response)); } }