Beispiel #1
0
        public async Task <IHttpActionResult> PutUser(int id, User user)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
        public bool UpdateInsurance(Insurance insurance)
        {
            bool success;

            try
            {
                context.Entry(insurance).State = EntityState.Modified;
                context.SaveChanges();
                success = true;
            }
            catch
            {
                success = false;
            }
            return(success);
        }
Beispiel #3
0
        public bool UpdateClient(Client client)
        {
            bool success;

            try
            {
                context.Entry(client).State = EntityState.Modified;
                context.SaveChanges();
                success = true;
            }
            catch
            {
                success = false;
            }
            return(success);
        }