public async Task <ServiceResponds <GetWolveDto> > UpdateWolve(UpDateWolveDto updateWolve) { ServiceResponds <GetWolveDto> serviceResponds = new ServiceResponds <GetWolveDto>(); try { Wolve wolve = await _context.Wolves.FirstOrDefaultAsync(c => c.Id == updateWolve.Id); wolve.Name = updateWolve.Name; wolve.Gender = updateWolve.Gender; wolve.Birthday = updateWolve.Birthday; wolve.Latitide = updateWolve.Latitide; wolve.Logitude = updateWolve.Logitude; _context.Wolves.Update(wolve); await _context.SaveChangesAsync(); serviceResponds.Data = _mapper.Map <GetWolveDto>(wolve); } catch (Exception ex) { serviceResponds.Success = false; serviceResponds.Message = ex.Message; } return(serviceResponds); }
public async Task <IActionResult> UpdateWolve(UpDateWolveDto upDateWolve) { ServiceResponds <GetWolveDto> response = await _wolveService.UpdateWolve(upDateWolve); if (response.Data == null) { return(NotFound(response)); } return(Ok(response)); }