Example #1
0
 public void PutPerson(int id, Person person)
 {
     if (id == person.PersonID)
     {
         db.Entry(person).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Example #2
0
        public IHttpActionResult PutDepartament(int id, Department departament)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DepartamentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutEmployee(int id, Employee employee)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #4
0
 public async Task UpdateClientAsync(Client client)
 {
     _context.Entry(client).State = EntityState.Modified;
     try
     {
         await _context.SaveChangesAsync();
     }
     catch (DbUpdateConcurrencyException)
     {
         throw;
     }
 }
Example #5
0
 public async Task UpdatePersonAsync(Person person)
 {
     _context.Entry(person).State = EntityState.Modified;
     try
     {
         await _context.SaveChangesAsync();
     }
     catch (DbUpdateConcurrencyException)
     {
         throw;
     }
 }
Example #6
0
 public async Task UpdateRoleAsync(Role role)
 {
     _context.Entry(role).State = EntityState.Modified;
     try
     {
         await _context.SaveChangesAsync();
     }
     catch (DbUpdateConcurrencyException)
     {
         throw;
     }
 }
Example #7
0
 public async Task UpdateTermAsync(Term term)
 {
     _context.Entry(term).State = EntityState.Modified;
     try
     {
         await _context.SaveChangesAsync();
     }
     catch (DbUpdateConcurrencyException)
     {
         throw;
     }
 }
Example #8
0
 public async Task UpdateWorkerAsync(Worker worker)
 {
     _context.Entry(worker).State = EntityState.Modified;
     try
     {
         await _context.SaveChangesAsync();
     }
     catch (DbUpdateConcurrencyException)
     {
         throw;
     }
 }
Example #9
0
        public async Task ChangePasswordAsync(int loginId, string newPassword)
        {
            var login = await GetLoginAsync(loginId);

            login.Password = newPassword;
            _context.Entry(login).State = EntityState.Modified;
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }
        }