示例#1
0
        public async Task UpdateCommet(int id, CommetUpdateDto commetUpdateDto)
        {
            Commet commet = _context.Commets.Find(id);

            _context.Entry(commet).CurrentValues.SetValues(commetUpdateDto);

            await _context.SaveChangesAsync();
        }
        public async Task <ActionResult> Update(int id, [FromBody] CommetUpdateDto commetUpdateDto)
        {
            try
            {
                await _commetRepository.UpdateCommet(id, commetUpdateDto);

                return(Ok());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }