public async Task <ActionResult> ConfirmAppointment(AppointmentLogEditModel model) { if (model.PhysicianId == null) { ModelState["PhysicianId"].Errors.Clear(); } if (ModelState.IsValid) { TimeSpan time = TimeSpan.Parse(model.TimeString); model.Time = (int)time.TotalMinutes; model.Status = (byte)AppointmentStatus.Create; string search = ""; var doctorList = await GetListDoctor(search); ViewBag.Doctors = doctorList; model.PhysicianIdTemp = model.PhysicianId; } else { string search = ""; var doctorList = await GetListDoctor(search); ViewBag.Doctors = doctorList; } return(PartialView("_Appointment", model)); }
/// <summary> /// Init appointment /// </summary> /// <returns></returns> public async Task <ActionResult> Make() { //get list of doctors string search = ""; var doctorList = await GetListDoctor(search); ViewBag.Doctors = doctorList; //Init appointment //var userId = GetUserId(); var appointmentModel = new AppointmentLogEditModel() { PatientId = _userSession.UserId }; return(View(appointmentModel)); }
/// <summary> /// Save appointment /// </summary> /// <param name="model"></param> /// <param name="action"></param> /// <returns></returns> private async Task <bool> Save(AppointmentLogEditModel model, string action) { bool result = false; try { var token = _userSession.BearerToken; string strUrl = APIProvider.APIGenerator(controllerName, APIConstant.ACTION_INSERT); result = await APIProvider.Authorize_DynamicTransaction <AppointmentLogEditModel, bool>(model, token, strUrl, APIConstant.API_Resource_CORE, ARS.Insert); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); Logger.LogError(ex); } return(result); }
/// <summary> /// View Appoiment /// </summary> /// <param name="Id"></param> /// <returns></returns> public async Task <ActionResult> AppointmentPartial(string Id) { //var userId = GetUserId(); var appointment = new AppointmentLogEditModel() { PatientId = _userSession.UserId }; appointment.PhysicianId = Id; string search = ""; var doctorList = await GetListDoctor(search); ViewBag.Doctors = doctorList; return(PartialView("_Appointment", appointment)); }
public async Task <ActionResult> ApplyAppointment(AppointmentLogEditModel model) { TimeSpan time = TimeSpan.Parse(model.TimeString); model.Time = (int)time.TotalMinutes; model.PhysicianId = model.PhysicianIdTemp; if (model.PhysicianId == null) { model.PhysicianId = ""; } ModelState["PhysicianId"].Errors.Clear(); if (ModelState.IsValid) { model.Id = Guid.NewGuid(); model.Status = (byte)AppointmentStatus.Create; var result = await Save(model, APIConstant.ACTION_INSERT); if (result) { TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.TypeResult.SUCCESS_APPOINTMENT, ApplicationGenerator.GeneralActionMessage(ValueConstant.ACTION_APPOINMENT, ApplicationGenerator.TypeResult.SUCCESS_APPOINTMENT)); return(RedirectToAction("Make")); } else { string search = ""; var doctorList = await GetListDoctor(search); ViewBag.Doctors = doctorList; return(PartialView("_Appointment", model)); } } else { string search = ""; var doctorList = await GetListDoctor(search); ViewBag.Doctors = doctorList; return(PartialView("_Appointment", model)); } }
public async Task <bool> Transaction(AppointmentLogEditModel model, char action) { var data = Mapper.Map <AppointmentLogEdit>(model); return(await _iAppointment.Transaction(data, action)); }