Пример #1
0
 public bool Save(ThingsTodoModel model)
 {
     using (DataProvider dp = new DataProvider())
     {
         var entity = data.GetEntityById(dp, model.Id);
         if (entity == null)
         {
             model.IsAlert    = false;
             model.CreateTime = DateTime.Now;
             dp.PM_ThingsTodo.Add(Mapper.Map <PM_ThingsTodo>(model));
         }
         else
         {
             entity.TodoDate   = model.TodoDate;
             entity.TodoThings = model.TodoThings;
             entity.UpdateUser = model.UpdateUser;
             entity.UpdateTime = DateTime.Now;
         }
         try
         {
             dp.SaveChanges();
             return(true);
         }
         catch
         {
             throw;
         }
     }
 }
Пример #2
0
 public ActionResult Save(ThingsTodoModel mod)
 {
     try
     {
         if (!mod.Id.HasValue)
         {
             mod.CreateUser = CurrentUser.Id;
         }
         else
         {
             mod.UpdateUser = CurrentUser.Id;
         }
         return(Json(new JsonMessage(business.Save(mod))));
     }
     catch (Exception e)
     {
         return(Json(new JsonMessage(false, e.Message)));
     }
 }