public VendorTypeMD ModifyVendorType(VendorTypeMD mod) { var entity = mod.Translate(); try { _VendorTypeRepo.Update(entity); _VendorTypeRepo.CommitAllChanges(); mod.AddSuccessMessage(string.Format(AppConstants.CRUD_UPDATE, "VendorType")); } catch (Exception) { mod.AddSuccessMessage(string.Format(AppConstants.CRUD_UPDATE_ERROR, "VendorType")); } return(mod); }
public VendorTypeMD AddVendorType(VendorTypeMD mod) { try { var entity = mod.Translate(); _VendorTypeRepo.Insert(entity); _VendorTypeRepo.CommitAllChanges(); mod.AddSuccessMessage(string.Format(AppConstants.CRUD_ADD, "VendorType")); mod.Id = entity.Id; } catch (Exception ex) { mod.HasErrors = true; mod.AddErrorMessage(string.Format(AppConstants.CRUD_ADD_ERROR, "VendorType")); } return(mod); }
public VendorTypeMD DeleteVendorType(long id) { var mod = new VendorTypeMD(); try { var VendorType = _VendorTypeRepo.Fetch(x => x.IsActive); VendorType.IsActive = false; _VendorTypeRepo.Update(VendorType); _VendorTypeRepo.CommitAllChanges(); mod.AddSuccessMessage(string.Format(AppConstants.CRUD_DELETE, "VendorType")); } catch (Exception ex) { mod.AddErrorMessage(string.Format(AppConstants.CRUD_DELETE_ERROR, "VendorType")); } return(mod); }