public bool ResumeProduct(RetailerUpdateProductDTO retailerProduct) { var currentUser = ClaimsPrincipal.Current.Identity.Name; if (retailerProduct.BranchIdList == null || retailerProduct.BranchIdList.Count <= 0) { retailerProduct.BranchIdList = GetBranchIdListFromStore(retailerProduct.StoreId); } try { foreach (var branch in retailerProduct.BranchIdList) { Pricing pricing = _unitOfWork.PricingRepository.Find(x => x.Store == retailerProduct.StoreId && x.Branch == branch && x.Product == retailerProduct.ProductId).FirstOrDefault <Pricing>(); pricing.IsDeleted = false; _unitOfWork.UpdateAndSave(pricing);//Here we may need to return number of Saved changes to ensures everything is good. } } catch { return(false); } return(true); }
public static Pricing UpdatePricing(this IGenericRepository <Pricing> pricingRepository, RetailerUpdateProductDTO retailerUpdateProductDTO, Pricing pricing, string user) { try { var oldPrice = pricing.Price; pricing.OldPrice = oldPrice ?? 0; pricing.Price = retailerUpdateProductDTO.NewPrice; pricing.SpecialPrice = retailerUpdateProductDTO.NewSpecialPrice; pricing.SpecialPriceDescription = retailerUpdateProductDTO.NewSpecialPriceDescription; pricing.AdditionalShippingCharge = retailerUpdateProductDTO.NewShippingCharge; pricing.AdditionalTax = retailerUpdateProductDTO.NewAdditionalTax; pricing.SpecialPriceStartDateTimeUtc = retailerUpdateProductDTO.NewPriceStartTime; pricing.SpecialPriceEndDateTimeUtc = retailerUpdateProductDTO.NewPriceEndTime; // pricing.IsFreeShipping = retailerUpdateProductDTO.NewIsFreeShipping; // pricing.IsShipEnabled = retailerUpdateProductDTO.NewIsShipEnabled; pricing.DeliveryTime = retailerUpdateProductDTO.NewDeliveryTime; pricing.UpdatedUser = user; pricingRepository.Attach(pricing); return(pricing); } catch { return(null); } }