public VendorMD AddVendor(VendorMD mod) { try { var entity = mod.Translate(); _VendorRepo.Insert(entity); _VendorRepo.CommitAllChanges(); mod.AddSuccessMessage(string.Format(AppConstants.CRUD_ADD, "Vendor")); mod.Id = entity.Id; } catch (Exception ex) { mod.AddErrorMessage(string.Format(AppConstants.CRUD_ADD_ERROR, "Vendor")); } return(mod); }
public VendorMD ModifyVendor(VendorMD mod) { var entity = mod.Translate(); try { _VendorRepo.Update(entity); _VendorRepo.CommitAllChanges(); mod.AddSuccessMessage(string.Format(AppConstants.CRUD_UPDATE, "Vendor")); } catch (Exception) { mod.AddSuccessMessage(string.Format(AppConstants.CRUD_UPDATE_ERROR, "Vendor")); } return(mod); }