public IHttpActionResult Allow(PromotionalDiscountModel discount) { List <DiscountBranch> list = new List <DiscountBranch>(); if (discount.BranchList != null && discount.ProductList != null) { foreach (var item in discount.ProductList) { foreach (var itemj in discount.BranchList) { DiscountBranch model = new DiscountBranch(); model.DiscountID = Convert.ToInt32(item); model.BranchID = Convert.ToInt32(itemj); model.IsActive = true; list.Add(model); } } try { db.DiscountBranches.AddRange(list); db.SaveChanges(); } catch (Exception ex) { } } return(Ok(true)); }
public ActionResult Index() { int id = Convert.ToInt32(Request.QueryString["id"]); if (id != 0) { ViewBag.Id = id; var data = Services.ProductService.GetAll(); var dataById = data.Where(x => x.Id == id).FirstOrDefault(); ViewBag.ProductSKU = dataById.ProductSKU; // ViewBag.StyleSKU = dataById.ProductStyle.StyleSKU; } PromotionalDiscountModel model = new PromotionalDiscountModel(); var BranchList = Services.BranchService.GetAll(); // var discount = Services.DiscountService.GetAll(); // model.DiscountList = discount; model.BranchList1 = BranchList; return(View(model)); }
public bool AllowDiscount(PromotionalDiscountModel model) { return(ServerResponse.Invoke <bool>("api/promotionalDiscount/allow", JsonConvert.SerializeObject(model), "POST")); }
public ActionResult Allow(PromotionalDiscountModel model) { bool status = Services.DiscountService.AllowDiscount(model); return(RedirectToAction("Index")); }
public ActionResult AllowDiscount(PromotionalDiscountModel promotion) { return(View()); }