public UpdateProductAvailabilityResponse UpdateProductAvailability(UpdateProductAvailabilityRequest request) { UpdateProductAvailabilityResponse updateProductAvailabilityResponse = new UpdateProductAvailabilityResponse(); updateProductAvailabilityResponse.Message = "Reciept availability not added successfully."; if (String.IsNullOrEmpty(request.AuthToken)) { updateProductAvailabilityResponse.Message = "Please pass all mandatory fields."; return(updateProductAvailabilityResponse); } AuthenticationToken authToken = new Helper().GetAuthenticationToken(request.AuthToken); if (authToken == null) { updateProductAvailabilityResponse.Message = "Unauthorizes user."; return(updateProductAvailabilityResponse); } List <OrderCandidateEL> lstOrderCandidates = new List <OrderCandidateEL>(); foreach (ProductDTO product in request.productInfo) { OrderCandidateEL orderCandidateEL = new OrderCandidateEL(); orderCandidateEL.IsAvailable = product.IsAvailable; orderCandidateEL.Price = product.Price; orderCandidateEL.StoreID = authToken.FkUserID; orderCandidateEL.ProductID = product.ProductID; lstOrderCandidates.Add(orderCandidateEL); } if (orderReceiptHelper.UpdateOrderCandidateByStoreProduct(lstOrderCandidates)) { updateProductAvailabilityResponse.Message = "Product availability updated successfully."; updateProductAvailabilityResponse.IsSuccess = true; return(updateProductAvailabilityResponse); } else { updateProductAvailabilityResponse.Message = "Some error occured."; return(updateProductAvailabilityResponse); } }
public bool AddOrderCandidate(OrderCandidateEL orderCandidateEL) { bool isOrderCandidateAdded = false; try { OrderCandidate orderCandidate = new OrderCandidate(); orderCandidate = MapperUtility.MapTo(orderCandidateEL, orderCandidate); using (uow = new UnitOfWork.UnitOfWork()) { uow.OrderCandidateRepository.Insert(orderCandidate); uow.Save(); isOrderCandidateAdded = true; } } catch { } return(isOrderCandidateAdded); }