public ActionResult AddAccountSubType(VMAccountSubType VMAccountSubType) { try { if (ModelState.IsValid) { tblUser user = Session[WebUtil.CURRENT_USER] as tblUser; if (!(user != null)) { return(RedirectToAction("RedirectToLogin", "user")); } tblAccountSubType Table = (VMAccountSubType).TotblAccountSubType(); Table.CompanyId = user.CompanyId; Table.CreatedBy = user.Id; Table.CreatedDate = DateTime.Now; new AccountSubTypeHandler().AddAccountSubType(Table); return(JavaScript("showMessage('success', 'Account Sub Type added Successfully','bottom-right','AccountSubType', 'Manage')")); } else { return(JavaScript("showMessage('error', 'All fields are required, Please try again','bottom-right','AccountSubType', 'Manage')")); } } catch (Exception ex) { return(JavaScript("showMessage('error', 'Failed to Add Account Sub Type, Please Contact to Administrator','bottom-right','AccountSubType', 'Manage')")); } }
public static tblAccountSubType TotblAccountSubType(this VMAccountSubType model) { tblAccountSubType table = new tblAccountSubType(); table.TypeName = model.TypeName; table.SubTypeName = model.SubTypeName; return(table); }
public static VMAccountSubType ToVMAccountSubType(this tblAccountSubType entity) { VMAccountSubType model = new VMAccountSubType(); model.Id = entity.Id; model.TypeName = entity.TypeName; model.SubTypeName = entity.SubTypeName; return(model); }