Ejemplo n.º 1
0
 public ActionResult AccountUpdate(AccountMsaterModel enAccount)
 {
     try
     {
         if (enAccount == null || string.IsNullOrEmpty(enAccount.account_code))
         {
             return(ExceptionError("account code for delete is null or empty!!"));
         }
         AccountMsaterModel en = dbcon.master_account.Find(AuthUser.SID, enAccount.account_code);
         en.account_name       = enAccount.account_name;
         en.updated_by         = AuthUser.UserId;
         en.updated_on         = ObjectUtil.getCurrentServerStringDateTime();
         en.updated_on_display = ObjectUtil.Convert2DateTimeDisplay(enAccount.updated_on);
         en.updated_by_name    = AuthUser.FullName;
         if (TryUpdateModel(en, "", new string[] { "sid", "account_code" }))
         {
             dbcon.SaveChanges();
             ModelState.Clear();
         }
         return(Json(en));
     }
     catch (Exception ex)
     {
         return(ExceptionError(ex.Message));
     }
 }
Ejemplo n.º 2
0
 public ActionResult AccountCraete(AccountMsaterModel enAccount)
 {
     if (ModelState.IsValid)
     {
         try
         {
             enAccount.sid                = AuthUser.SID;
             enAccount.created_by         = AuthUser.UserId;
             enAccount.created_on         = ObjectUtil.getCurrentServerStringDateTime();
             enAccount.created_on_display = ObjectUtil.Convert2DateTimeDisplay(enAccount.created_on);
             dbcon.master_account.Add(enAccount);
             dbcon.SaveChanges();
             ModelState.Clear();
             enAccount.created_by_name = AuthUser.FullName;
             enAccount.updated_by_name = "";
             return(Json(enAccount));
         }
         catch (Exception ex)
         {
             return(ExceptionError(ex.Message));
         }
     }
     return(Json(enAccount));
 }