public ActionResult Edit([Bind(Include = "Id,Name,File")] TimeSheet timeSheet)
 {
     if (ModelState.IsValid)
     {
         db.Entry(timeSheet).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(timeSheet));
 }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Description,Cost,IsMale,Duration")] Price price)
 {
     if (ModelState.IsValid)
     {
         db.Entry(price).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(price));
 }
 public ActionResult Edit([Bind(Include = "Id,Name")] Barbershop barbershop)
 {
     if (ModelState.IsValid)
     {
         db.Entry(barbershop).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(barbershop));
 }
Ejemplo n.º 4
0
        public ActionResult Edit(Employee employee, HttpPostedFileBase upimage = null)
        {
            if (!ModelState.IsValid)
            {
                return(View(employee));
            }

            if (upimage != null)
            {
                byte[] imageData = null;
                using (var binaryReader = new BinaryReader(upimage.InputStream))
                {
                    imageData = binaryReader.ReadBytes(upimage.ContentLength);
                }

                employee.Image = imageData;
            }

            db.Entry(employee).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }