Example #1
0
        public async Task <IActionResult> OnPost()
        {
            OfferCreateInput.Name       = Name;
            OfferCreateInput.Discount   = Discount;
            OfferCreateInput.ExpiryDate = ExpiryDate;
            OfferCreateInput.TotalPrice = decimal.Round(TotalPrice, 2);
            OfferCreateInput.ImageUrl   = ImageUrl;
            offersService.Create(OfferCreateInput);

            return(RedirectToPage("./Index"));
        }
Example #2
0
 public IActionResult OnPost(OfferListViewModel offer)
 {
     if (ModelState.IsValid)
     {
         var domainModel = offer.ToModel();
         var response    = _offersService.Create(domainModel);
         if (!response.IsSuccessfull)
         {
             ErrorMessage = response.Message;
             return(Page());
         }
     }
     return(RedirectToPage("/Admin/OffersList"));
 }