Exemplo n.º 1
0
        public async Task <IActionResult> Update(int id, TEntity entity)
        {
            if (id != entity.Id)
            {
                return(BadRequest());
            }

            await service.UpdateAsync(entity);

            return(Ok());
        }
        public async Task Post(int id, Client value)
        {
            if (value.Id == id)
            {
                Client client = await service.FindByIdAsync(id);

                if (client != null)
                {
                    client.Code       = value.Code;
                    client.DateUpdate = DateTime.UtcNow;
                    client.Name       = value.Name;
                    client.EMail      = value.EMail;
                    client.Phone      = value.Phone;
                    client.Comment    = value.Comment;
                    //
                    await service
                    .UpdateAsync(client);
                }
            }
        }