public T_TimeLog Loggout([FromBody] T_TimeLog value) { value.LoggedOut = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); var emp = obj.T_TimeLog.Find(value.AttendanceId); emp.LoggedOut = value.LoggedOut; // emp.AttendanceStatus = "Present"; //emp.WorkingHours = Convert.ToInt32(emp.LoggedOut - emp.LoggedIn); obj.SaveChanges(); return(emp); }
// POST: api/Timelog public Response Post([FromBody] T_TimeLog value) { value.LoggedIn = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); DateTime thisday = DateTime.Today; value.TodayDate = thisday; var res = obj.T_TimeLog.Add(value); obj.SaveChanges(); Response result = new Response(); result.Data = res; result.Status = "success"; result.Error = null; return(result); }