public async Task <IActionResult> PutCustomer(int id, HISCustomer customer)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (customerDb.GetById(id) != null)
                    {
                        var result = await customerDb.Update(customer);

                        return(NoContent());
                    }
                    else
                    {
                        return(NotFound());
                    }
                }
                else
                {
                    return(BadRequest(ModelState));
                }
            }
            catch (Exception E)
            {
                //E
                var msg = (E.InnerException != null) ? (E.InnerException.Message) : (E.Message);
                return(StatusCode(500, "Admin is working on it! " + msg));
            }
        }
Beispiel #2
0
        public async Task <bool> Update(HISCustomer story)
        {
            dbContext.Update(story);
            var result = await dbContext.SaveChangesAsync();

            if (result != 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }