Example #1
0
        public static CalendarSettingDTM changeToDTM(CalendarSetting setting)
        {
            CalendarSettingDTM cSetting = new CalendarSettingDTM();

            cSetting.EmployeeId         = setting.EmployeeId;
            cSetting.View               = setting.View;
            cSetting.FirstHour          = setting.FirstHour;
            cSetting.WorkingDayDuration = setting.WorkingDayDuration;
            cSetting.SlotDuration       = setting.SlotDuration;
            return(cSetting);
        }
Example #2
0
        public static CalendarSetting changeFromDTM(CalendarSettingDTM cSettingDtm)
        {
            CalendarSetting cSetting = new CalendarSetting();

            cSetting.EmployeeId         = cSettingDtm.EmployeeId;
            cSetting.View               = cSettingDtm.View;
            cSetting.FirstHour          = cSettingDtm.FirstHour;
            cSetting.WorkingDayDuration = cSettingDtm.WorkingDayDuration;
            cSetting.SlotDuration       = cSettingDtm.SlotDuration;

            if (cSettingDtm.Employee != null)
            {
                cSetting.Employee = changeFromDTM(cSettingDtm.Employee);
            }

            return(cSetting);
        }
        public async Task <HttpResponseMessage> Put([FromBody] CalendarSettingDTM cSettingsDtm)
        {
            try
            {
                var originalSetting = TheRepo.CalendarSettingsDTM.Get(cSettingsDtm.EmployeeId);

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

                    return(Request.CreateResponse(HttpStatusCode.OK, cSettingsDtm));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }