Example #1
0
        public async Task <string> UpdateMonitorAttendance(int id, MonitorAttendance monitorAttendance)
        {
            try
            {
                var res = await _repository.UpdateMonitorAttendances(id, monitorAttendance);

                return(res);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        public async Task <MonitorAttendance> CreateNewMonitorAttendance(MonitorAttendance monitorAttendance)
        {
            try
            {
                var res = await _repository.CreateNewMonitorAttendances(monitorAttendance);

                return(res);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        public async Task <MonitorAttendance> CreateNewMonitorAttendances(MonitorAttendance monitorAttendances)
        {
            try
            {
                _context.MonitorAttendances.Add(monitorAttendances);
                await _context.SaveChangesAsync();

                return(monitorAttendances);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task <IActionResult> CreateMonitorAttendance(MonitorAttendance monitorAttendance)
        {
            try
            {
                var response = await _service.CreateNewMonitorAttendance(monitorAttendance);

                if (response != null)
                {
                    return(Ok(response));
                }
                return(StatusCode(StatusCodes.Status204NoContent));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #5
0
        public async Task <string> UpdateMonitorAttendances(int id, MonitorAttendance monitorAttendances)
        {
            try
            {
                var res = await _context.MonitorAttendances.FirstOrDefaultAsync(m => m.MonitorAttendanceId == id);

                res.EmployeeName = monitorAttendances.EmployeeName;
                res.TimeIn       = monitorAttendances.TimeIn;
                res.TimeOut      = monitorAttendances.TimeOut;
                res.Note         = monitorAttendances.Note;
                _context.Update(res);
                await _context.SaveChangesAsync();

                return("Updated Record");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task <IActionResult> UpdateMonitorAttendance(int MonitorAttendanceId, MonitorAttendance monitorAttendance)
        {
            try
            {
                var res = await _service.UpdateMonitorAttendance(MonitorAttendanceId, monitorAttendance);

                if (res != null)
                {
                    return(Ok(res));
                }
                return(StatusCode(StatusCodes.Status204NoContent));
            }
            catch (Exception ex)
            {
                throw;
            }
        }