public ActionResult Edit(CompanyViewModel model) { if (ModelState.IsValid) { model.Update_By = User.Identity.Name; ResultResponse result = CompanyRepo.Update(model); return(Json(new { success = result.Success, entity = model, message = result.Message }, JsonRequestBehavior.AllowGet)); } else { ResultResponse result = new ResultResponse(); result.Success = false; result.Message = "Theres blank column, Please fill data correctly !"; return(Json(new { success = result.Success, entity = model, message = result.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult Edit(CompanyViewModel model) { if (CompanyRepo.Update(model)) { return(Json(new { success = true, entity = model }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false }, JsonRequestBehavior.AllowGet)); } }
private void Save(string strLink = "") { try { var Company = _CompanyRepo.GetById(id); if (id > 0 && Company != null) { Company.NAME = txtName.Text; //Company.TAX_CODE = txtTaxCode.Text; Company.EMAIL = txtEmail.Text; Company.PHONE = txtPhone.Text; Company.ADDRESS = txtAddress.Text; _CompanyRepo.Update(Company); strLink = string.IsNullOrEmpty(strLink) ? "chi-tiet-cong-ty.aspx?id=" + id : strLink; } else { Company = new COMPANY(); Company.NAME = txtName.Text; //Customer.TAX_CODE = txtTaxCode.Text; Company.EMAIL = txtEmail.Text; Company.PHONE = txtPhone.Text; Company.ADDRESS = txtAddress.Text; Company.CREATOR_ID = Utils.CIntDef(Session["Userid"]); Company.CREATED_DATE = DateTime.Now; _CompanyRepo.Create(Company); strLink = string.IsNullOrEmpty(strLink) ? "chi-tiet-cong-ty.aspx?id=" + Company.ID : strLink; } } catch (Exception) { throw; } finally { if (!string.IsNullOrEmpty(strLink)) { Response.Redirect(strLink); } } }