public ActionResult Edit([Bind(Include = "Id, Name, Description, PricePerMinute")] Service service)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(service).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (DataException)
     {
         //Log the error
         ModelState.AddModelError("", PageStrings.EditErrorMessageText);
     }
     return(View(service));
 }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "Id,Person,PhoneNumber")] Client client)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(client).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index", "ProvidedService", new { clientId = client.Id }));
         }
     }
     catch (DataException)
     {
         //Log the error
         ModelState.AddModelError("", PageStrings.EditErrorMessageText);
     }
     return(View(client));
 }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "Id,ServiceDate,NumberOfMinutes,ClientId,ServiceId")] ProvidedService providedService)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(providedService).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index", new { clientId = providedService.ClientId }));
         }
     }
     catch (DataException)
     {
         //Log the error
         ModelState.AddModelError("", PageStrings.EditErrorMessageText);
     }
     PopulateClientsDropDownList(providedService.ClientId);
     PopulateServicesDropDownList(providedService.ServiceId);
     return(View(providedService));
 }
Ejemplo n.º 4
0
        public async Task <ActionResult> Edit([Bind(Include = "CarId,Model,Color,ArrivalTime,PickUpTime,WashType,Cost,PaidConfirmed,TakeConfirmed,TypeOfCar,Status,Faktura,Payment")] CarInfo carInfo)
        {
            if (ModelState.IsValid)
            {
                db.Entry(carInfo).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(carInfo));
        }
Ejemplo n.º 5
0
 public void Update(T obj)
 {
     table.Attach(obj);
     _context.Entry(obj).State = EntityState.Modified;
 }