public async Task <ServiceResponse <object> > EditAttendance(int id, AttendanceDtoForEdit attendance) { Attendance dbObj = _context.Attendances.FirstOrDefault(s => s.Id.Equals(id) && s.SchoolBranchId == _LoggedIn_BranchID); if (dbObj != null) { dbObj.Comments = attendance.Comments; dbObj.Present = attendance.Present; dbObj.Absent = attendance.Absent; dbObj.Late = attendance.Late; await _context.SaveChangesAsync(); } _serviceResponse.Message = CustomMessage.Updated; _serviceResponse.Success = true; return(_serviceResponse); }
public async Task <IActionResult> Put(int id, AttendanceDtoForEdit attendance) { _response = await _repo.EditAttendance(id, attendance); return(Ok(_response)); }