Пример #1
0
        public async Task <IHttpActionResult> PutClient(int id, Client client)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != client.Id)
            {
                return(BadRequest());
            }

            db.Entry(client).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ClientExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
        public async Task <IActionResult> PutAirport([FromRoute] int id, [FromBody] Airport airport)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != airport.Id)
            {
                return(BadRequest());
            }

            _context.Entry(airport).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AirportExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #3
0
 public ActionResult Edit([Bind(Include = "Id,LName,FName,EmployedDate")] Staff staff)
 {
     if (ModelState.IsValid)
     {
         db.Entry(staff).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(staff));
 }
Пример #4
0
 public ActionResult Edit([Bind(Include = "Id,Code,DestPlace,FlightDate")] Flight flight)
 {
     if (ModelState.IsValid)
     {
         db.Entry(flight).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(flight));
 }
Пример #5
0
 public ActionResult Edit([Bind(Include = "Id,LName,FName,EnrolmentDate")] Client client)
 {
     if (ModelState.IsValid)
     {
         db.Entry(client).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(client));
 }
Пример #6
0
 public ActionResult Edit([Bind(Include = "Id,Name,Origin")] Airline airline)
 {
     if (ModelState.IsValid)
     {
         db.Entry(airline).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(airline));
 }
Пример #7
0
        public async Task <IActionResult> resetPassword(int id, User user)
        {
            var editPassword = await _context.Users.SingleOrDefaultAsync(r => r.ID == user.ID);

            if (editPassword != null)
            {
                if (ModelState.IsValid)
                {
                    string password = Crypto.HashPassword(user.Password);
                    editPassword.Password = password;
                    _context.Entry(editPassword).State = EntityState.Modified;
                    _context.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            return(View());
        }
Пример #8
0
 public void Change(Airlines airlineNew)
 {
     context.Entry(airlineNew).State = EntityState.Modified;
 }
Пример #9
0
 public void Change(Pilot pilotNew)
 {
     context.Entry(pilotNew).State = EntityState.Modified;
 }
Пример #10
0
 public void change(Country c)
 {
     context.Entry(c).State = EntityState.Modified;
 }
Пример #11
0
 public void Change(Flight flightNew)
 {
     context.Entry(flightNew).State = EntityState.Modified;
 }