示例#1
0
        public ActionResult Edit(int id, PackVM ovm)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (id == null)
                    {
                        return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                    }
                    Pack p = service.GetById(id);

                    p.Description = ovm.Description;
                    p.EndDate     = ovm.EndDate;
                    p.StartDate   = ovm.StartDate;
                    p.PackName    = ovm.PackName;
                    p.TypePack    = ovm.TypePack;
                    p.Quantity    = ovm.Quantity;

                    //ss
                    if (p == null)
                    {
                        return(HttpNotFound());
                    }

                    service.Update(p);
                    service.Commit();
                    // Service.Dispose();

                    return(RedirectToAction("Index"));
                }
                // TODO: Add delete logic here
                return(View(ovm));
            }
            catch
            {
                return(View());
            }
        }
示例#2
0
        public ActionResult Edit(int id, Pack AVM)
        {
            try
            {
                // TODO: Add update logic here
                Pack A = PackService.GetById(id);
                A.Id              = AVM.Id;
                A.date_deb        = AVM.date_deb;
                A.date_expiration = AVM.date_expiration;
                A.ListPanier      = AVM.ListPanier;
                A.ListProduct     = AVM.ListProduct;
                A.Price           = AVM.Price;

                PackService.Update(A);
                PackService.Commit();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
示例#3
0
 public PackEntity Update(Guid PackId, [FromBody] PackEntity PackEntity)
 {
     return(PackService.Update(EmployeeEntity, PackId, PackEntity));
 }