public async Task <Response> Create(Attendance item) { Response response = new Response(); try { ValidationResult validationResponse = await new AttendanceValidator().ValidateAsync(item); if (!validationResponse.IsValid) { response.Success = false; response.ErrorList.Add("Validation Error"); return(response); } response = await _repository.Create(item); return(response); } catch (Exception e) { StringBuilder sb = new StringBuilder(); log.Error(sb.AppendLine(e.Message).AppendLine(e.StackTrace).ToString()); response.ErrorList.Add("Error while creating Attendance."); response.Success = false; return(response); } }
public void OnPostFilter(AttendanceViewModel command) { var Edate = command.EntranceDate; PersianCalendar p = new PersianCalendar(); DateTime x = p.ToDateTime(Edate.Year, Edate.Month, Edate.Day, Edate.Hour, Edate.Minute, Edate.Second, Edate.Millisecond); _attendanceRepository.Create(new Domain.AttendanceAgg.Attendance(int.Parse(command.StaffName), command.EntranceTime, command.LeaveTime, x)); }
public Task <Attendance> Create(Attendance attendance) { return(_attendanceRepository.Create(attendance)); }