Example #1
0
        public ActionResult AddClinicDays(ClinicDayViewModel clinicDay)
        {
            if (ModelState.IsValid)
            {
                var day = clinicDay.Day;

                var openTime = clinicDay.StartTimeHour + ":"
                               + clinicDay.StartTimeMin + " "
                               + clinicDay.StartAMPM;
                var closeTime = clinicDay.EndTimeHour + ":"
                                + clinicDay.EndTimeMin + " "
                                + clinicDay.EndAMPM;

                var addClinicDay = new ClinicDay()
                {
                    Day       = day,
                    OpenTime  = openTime,
                    CloseTime = closeTime,
                    ClinicId  = clinicDay.ClinicId
                };

                // add clinic day
                var created = _clinicRepository.AddClinicDay(addClinicDay);
                if (created)
                {
                    return(RedirectToAction("Index"));
                }

                return(HttpNotFound("Unale to save day. Something went wrong while saving"));
            }

            return(View(clinicDay));
        }