Example #1
0
        public static WorkingHourDTM changeToDTM(WorkingHour workingHour)
        {
            WorkingHourDTM workingHourDTM = new WorkingHourDTM();

            workingHourDTM.EmployeeId     = workingHour.EmployeeId;
            workingHourDTM.MondayStart    = workingHour.MondayStart;
            workingHourDTM.MondayStop     = workingHour.MondayStop;
            workingHourDTM.TuesdayStart   = workingHour.TuesdayStart;
            workingHourDTM.TuesdayStop    = workingHour.TuesdayStop;
            workingHourDTM.WednesdayStart = workingHour.WednesdayStart;
            workingHourDTM.WednesdayStop  = workingHour.WednesdayStop;
            workingHourDTM.ThursdayStart  = workingHour.ThursdayStart;
            workingHourDTM.ThursdayStop   = workingHour.ThursdayStop;
            workingHourDTM.FridayStart    = workingHour.FridayStart;
            workingHourDTM.FridayStop     = workingHour.FridayStop;
            workingHourDTM.SaturdayStart  = workingHour.SaturdayStart;
            workingHourDTM.SaturdayStop   = workingHour.SaturdayStop;
            workingHourDTM.SundayStart    = workingHour.SundayStart;
            workingHourDTM.SundayStop     = workingHour.SundayStop;

            return(workingHourDTM);
        }
Example #2
0
        public async Task <HttpResponseMessage> Put([FromBody] WorkingHourDTM wHoursDtm)
        {
            try
            {
                var originalWHours = TheRepo.WorkingHoursDTM.Get(wHoursDtm.EmployeeId);

                if (originalWHours == null)
                {
                    return(Request.CreateResponse(HttpStatusCode.NotModified, "Item is not found"));
                }
                else
                {
                    await TheRepo.WorkingHoursDTM.Update(wHoursDtm);

                    return(Request.CreateResponse(HttpStatusCode.OK, wHoursDtm));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }
Example #3
0
        public static WorkingHour changeFromDTM(WorkingHourDTM workingHourDtm)
        {
            WorkingHour workingHour = new WorkingHour();

            workingHour.EmployeeId     = workingHourDtm.EmployeeId;
            workingHour.MondayStart    = workingHourDtm.MondayStart;
            workingHour.MondayStop     = workingHourDtm.MondayStop;
            workingHour.TuesdayStart   = workingHourDtm.TuesdayStart;
            workingHour.TuesdayStop    = workingHourDtm.TuesdayStop;
            workingHour.WednesdayStart = workingHourDtm.WednesdayStart;
            workingHour.WednesdayStop  = workingHourDtm.WednesdayStop;
            workingHour.ThursdayStart  = workingHourDtm.ThursdayStart;
            workingHour.ThursdayStop   = workingHourDtm.ThursdayStop;
            workingHour.FridayStart    = workingHourDtm.FridayStart;
            workingHour.FridayStop     = workingHourDtm.FridayStop;
            workingHour.SaturdayStart  = workingHourDtm.SaturdayStart;
            workingHour.SaturdayStop   = workingHourDtm.SaturdayStop;
            workingHour.SundayStart    = workingHourDtm.SundayStart;
            workingHour.SundayStop     = workingHourDtm.SundayStop;

            workingHour.Employee = workingHourDtm.Employee == null ? null : changeFromDTM(workingHourDtm.Employee);
            return(workingHour);
        }