public async Task <IActionResult> Edit(int id, [Bind("Company_ID,Company_Name,Contact_Number,Company_Address,Contact,Company_Edate")] Company_Master company_Master) { if (id != company_Master.Company_ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(company_Master); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Company_MasterExists(company_Master.Company_ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(company_Master)); }
private void SaveData(LifeLineDbContext context) { Company_Master obj = new Company_Master(); obj.companyName = txtCompanyName.Text.Trim(); obj.signatoryType = txtSignType.Text.Trim(); obj.title = txtTitle.Text.Trim(); obj.address1 = txtAddress1.Text.Trim(); obj.address2 = txtAddress2.Text.Trim(); obj.area = txtArea.Text.Trim(); obj.city = txtCity.Text.Trim(); obj.stateId = ddlState.SelectedIndex == 0 ? null : (int?)Convert.ToInt32(ddlState.SelectedValue); obj.pincode = txtPincode.Text.Trim(); obj.phoneNumber = txtPhoneNo.Text.Trim(); obj.mobileNumber = txtMobileNo.Text.Trim(); obj.faxNumber = txtFaxNo.Text.Trim(); obj.emailId = txtEmail.Text.Trim(); obj.taxSaleValue = string.IsNullOrWhiteSpace(txtTaxSaleValue.Text) ? null : (int?)Convert.ToDecimal(txtTaxSaleValue.Text); obj.VatTinNo = txtVatNo.Text.Trim(); obj.CstTinNo = txtCstNo.Text.Trim(); obj.entryBy = SessionHelper.UserId; obj.entryDate = DateTime.Now; obj.updatedOn = null; context.AddToCompany_Master(obj); }
public async Task <IActionResult> Create([Bind("Company_ID,Company_Name,Contact_Number,Company_Address,Contact,Company_Edate")] Company_Master company_Master) { if (ModelState.IsValid) { _context.Add(company_Master); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(company_Master)); }