public ActionResult AddCompany(VMCompany VMcompany) { try { if (ModelState.IsValid) { tblUser user = Session[WebUtil.CURRENT_USER] as tblUser; if (!(user != null)) { return(RedirectToAction("RedirectToLogin", "user")); } tblCompany Table = (VMcompany).TotblCompany(); Table.CreatedBy = user.Id; Table.CreatedDate = DateTime.Now; new CompanyHandler().AddCompany(Table); return(JavaScript("showMessage('success', 'Company added Successfully','bottom-right','Company', 'Manage')")); } else { return(JavaScript("showMessage('error', 'All fields are required, Please try again','bottom-right','Company', 'Manage')")); } } catch (Exception ex) { return(JavaScript("showMessage('error', 'Failed to Add Company, Please Contact to Administrator','bottom-right','Company', 'Manage')")); } }
public static tblCompany TotblCompany(this VMCompany model) { tblCompany table = new tblCompany(); table.Name = model.Name; table.Street = model.Street; table.City = model.City; table.Country = model.Country; table.Landline = model.Landline; table.Mobile = model.Mobile; table.FaxNo = model.FaxNo; table.Website = model.Website; table.NTN = model.NTN; table.STN = model.STN; return(table); }
public static VMCompany ToVMCompany(this tblCompany entity) { VMCompany model = new VMCompany(); model.Id = entity.Id; model.Name = entity.Name; model.Street = entity.Street; model.City = entity.City; model.Country = entity.Country; model.Landline = entity.Landline; model.Mobile = entity.Mobile; model.FaxNo = entity.FaxNo; model.Website = entity.Website; //model.NTN = (long)entity.NTN; //model.STN = (long)entity.STN; return(model); }