public ActionResult ReadTimeType(int id) { using (var context = new DataContext()) { try { Account account = base.GetLoginAccount(); TimeType dbm = TimeTypeOperations.TryRead(account, context, id); return(Json(new UITimeType_RU(dbm))); } catch (Exception e) { base.HandleException("ReadTimeType", e); return(null); } } }
public ActionResult UpdateTimeType(UITimeType_RU uim) { AjaxStatus status = new AjaxStatus(); using (var context = new DataContext()) { try { Account account = base.GetLoginAccount(); TimeType dbm = TimeTypeOperations.TryRead(account, context, uim.id); dbm = uim.UpdateModel(dbm); TimeTypeOperations.TryUpdate(account, context, dbm); context.SaveChanges(); } catch (Exception e) { base.HandleException("UpdateTimeType", e); status.SetError(e.Message); } } return(Json(status)); }