public async Task <SharedLookUpResponse> UpdateComponentAsync(UpdateTimesheet updateComponentAc, int instituteId) { var updateTimesheet = await iMSDbContext.Timesheets.FirstAsync(x => x.Id == updateComponentAc.Id); updateTimesheet.StaffId = updateComponentAc.StaffId; updateTimesheet.PresenceDate = new DateTime(updateComponentAc.PresenceDate.Year, updateComponentAc.PresenceDate.Month, updateComponentAc.PresenceDate.Day); updateTimesheet.PresenceType = updateComponentAc.PresenceType; iMSDbContext.Timesheets.Update(updateTimesheet); await iMSDbContext.SaveChangesAsync(); return(new SharedLookUpResponse() { HasError = false, Message = "Timesheet Entry updated successfully" }); }
public async Task <IActionResult> UpdateGroupAsync([FromBody] UpdateTimesheet updateComponentGroupAc) { var instituteId = await GetUserCurrentSelectedInstituteIdAsync(); if (await iMSDbContext.Timesheets.AnyAsync(x => x.Id == updateComponentGroupAc.Id && x.InstituteId == instituteId)) { return(Ok(await timesheetManagementRepository.UpdateComponentAsync(updateComponentGroupAc, instituteId))); } else { return(Ok(new SharedLookUpResponse() { HasError = true, ErrorType = SharedLookUpResponseType.Code, Message = "Timesheet entry not found" })); } }