public IActionResult ChangePackage(PackageDetailViewModel model) { if (ModelState.IsValid) { var package = _packageService.GetById(model.Id); if (package == null) { return(NotFound()); } var card = _cardService.GetCurrentUserCard(_userManager.GetUserId(HttpContext.User)); if (card == null) { return(NotFound()); } card.Package = package; _cardService.Update(card); var cp = _cpService.GetByCardId(card.Id); cp.Package = package; cp.ExpirationDate = DateTime.Now; cp.Status = _statusService.GetByName("Recharged"); _cpService.Update(cp); ViewBag.success = "success"; ViewBag.msg = "Your Package Has been Changed. You need to Recharged Your Package."; return(RedirectToAction("MyPackage")); } return(View(model)); }
public IActionResult ChangePackage(int?PackageId) { if (PackageId == null) { return(NotFound()); } var package = _packageService.GetById(PackageId); if (package == null) { return(NotFound()); } var model = new PackageDetailViewModel { Id = package.Id, PackageName = package.PackageName }; if (model == null) { return(NotFound()); } return(View(model)); }
protected void gvwPackage_RowDataBound(object sender, GridViewRowEventArgs e) { PackageDetailViewModel row = e.Row.DataItem as PackageDetailViewModel; if (e.Row.RowType == DataControlRowType.DataRow) { (e.Row.FindControl("chkIsTaxable") as CheckBox).Checked = row.IsTaxed; } }
public IActionResult Detail(int id) { var package = _packageService.GetById(id); var model = new PackageDetailViewModel() { Id = id, ImageUrl = package.ImageUrl, Charges = package.Charges, PackageName = package.PackageName, DocumentariesChannel = package.DocumentariesChannel, EntertainmentChannel = package.EntertainmentChannel, NewsChannel = package.NewsChannel, NoOfChannels = package.NoOfChannels, SportsChannel = package.SportsChannel }; return(View(model)); }
public IHttpResponse Details(int id) { var package = this.Db.Packages.FirstOrDefault(p => p.Id == id); if (package == null) { return(this.BadRequestError("Package with id do not exist.")); } if (package.RecipientId.ToString() != this.User.Info) { return(this.BadRequestError("You do not have rights to view this detail view.")); } var date = "N/A"; if (package.Status == Status.Shipped) { date = package.EstimateDeliveryDate.ToString(); } if (package.Status == Status.Delivered || package.Status == Status.Acquired) { date = "Delivered"; } var model = new PackageDetailViewModel() { Id = package.Id, Description = package.Description, ShippingAddress = package.ShippingAddress, Status = package.Status.ToString(), EstimateDeliveryDate = date, Weight = package.Weight, Recipient = package.Recipient.Username }; return(this.View(model)); }