예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public VendorMD DeleteVendor(long id)
        {
            var mod = new VendorMD();

            try
            {
                var Vendor = _VendorRepo.Fetch(x => x.IsActive);
                Vendor.IsActive = false;
                _VendorRepo.Update(Vendor);
                _VendorRepo.CommitAllChanges();

                mod.AddSuccessMessage(string.Format(AppConstants.CRUD_DELETE, "Vendor"));
            }
            catch (Exception ex)
            {
                mod.AddErrorMessage(string.Format(AppConstants.CRUD_DELETE_ERROR, "Vendor"));
            }
            return(mod);
        }