Ejemplo n.º 1
0
 public ActionResult Edit(string id = "")
 {
     using (DIC_TINH dic_tinh = new DIC_TINH())
     {
         return(View(dic_tinh.Get(id)));
     }
 }
Ejemplo n.º 2
0
 public ActionResult Edit(string id, DIC_TINH model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             model.Cap = model.GetCapById(model.Cap);
             var entityUpdate = model.Get(DataConverter.StringToInt(id));
             if (entityUpdate != null)
             {
                 entityUpdate.MaTinh  = model.MaTinh;
                 entityUpdate.TenTinh = model.TenTinh;
                 entityUpdate.Cap     = model.Cap;
                 entityUpdate.Status  = model.Status;
                 var result = entityUpdate.Update();
                 if (result == data.enums.SqlResultType.OK)
                 {
                     this.ShowNotification(data.enums.MessageObjectType.Success, "", "Chỉnh sửa thành công.");
                     return(RedirectToAction("Index"));
                 }
                 else
                 {
                     this.GetMessageFromSqlState(result, "Mã tỉnh");
                     return(View(model));
                 }
             }
             else
             {
                 this.GetMessageFromSqlState(data.enums.SqlResultType.NotExisted, "Mã tỉnh");
                 return(View(model));
             }
         }
         catch (Exception ex)
         {
             this.HanderException(ex);
             return(View(model));
         }
     }
     else
     {
         return(View(model));
     }
 }