public ActionResult AddBusinessPromotion(BusinessPromotion bs) { if (bs != null) { if (bs.EndDate == DateTime.MinValue) bs.EndDate = DateTime.Now.AddDays(7); businessPromotionService.Add(bs); return Json(true, JsonRequestBehavior.AllowGet); } return Json(false, JsonRequestBehavior.AllowGet); }
/// <summary> /// Create a Bisomess Promotion View Model /// </summary> /// <param name="a"></param> /// <returns></returns> private PromotionViewModel CreateBizPromotionVM(BusinessPromotion a) { return new PromotionViewModel() { Id = a.Id, PromotionId = a.PromotionId, Promotion = a.Promotion != null ? new Promotion() { Id = a.Promotion.Id, Name = a.Promotion.Name } : new Promotion(), Business = a.Business != null ? new Business() { Id = a.Business.Id, Name = a.Business.Name } : new Business(), Limitation = a.Limitation, BusinessId = a.BusinessId, Discount = a.Discount, EndDate = a.EndDate, StartDate = a.StartDate, Viewed = a.Viewed, Redeemed = a.Redeemed, PromotionCode = a.PromotionCode, Title = a.Title, Description = a.Description, BusinessName = a.Business.Name, Status = a.Status.ToString(), ShowPromotionCode = a.ShowPromotionCode }; }
public ActionResult EditBusinessPromotion(BusinessPromotion bs) { if (bs != null && bs.Id != Guid.Empty) { bs.Business = null; bs.Promotion = null; businessPromotionService.Update(bs); return Json(true, JsonRequestBehavior.AllowGet); } return Json(false, JsonRequestBehavior.AllowGet); }