public string SaveAmountBasisOffer(AmountBasisOfferModel model) { try { Nibs_Offer offers = new Nibs_Offer(); offers.OfferType = model.OfferType; _entities.Nibs_Offer.Add(offers); _entities.SaveChanges(); int Max = _entities.Nibs_Offer.Max(x => x.OfferId); var Days = model.Days.Split(','); for (int i = 0; i < Days.Length; i++) { Nibs_Offer_Days days = new Nibs_Offer_Days(); days.Days = Days[i]; days.OfferId = Max; _entities.Nibs_Offer_Days.Add(days); _entities.SaveChanges(); } Nibs_Offer_Amount tb = new Nibs_Offer_Amount(); tb.Amount = model.Amount; tb.Discount = model.Discount; tb.ItemId = model.ItemId; tb.OfferId = Max; tb.Quantity = model.Quantity; _entities.Nibs_Offer_Amount.Add(tb); _entities.SaveChanges(); return("record saved successfully.."); } catch { return("Try Again !"); } }
public ActionResult AmountBasis(AmountBasisOfferModel model) { var Data = obj.SaveAmountBasisOffer(model); TempData["result"] = Data; return(RedirectToAction("Index")); }