Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }