예제 #1
0
        public async Task <IActionResult> InsertUpdateConsultant(ConsultantVM consultantModel)
        {
            if (ModelState.IsValid)
            {
                if (consultantModel.Id == Guid.Empty)
                {
                    if (await _consultantRepository.SaveConsultant(consultantModel) == Shared.Helpers.DbStatusCode.Created)
                    {
                        TempData["ConsultantActionResponse"] = true;
                    }
                    else
                    {
                        TempData["ConsultantActionResponse"] = false;
                    }
                }
                else
                {
                    if (await _consultantRepository.UpdateConsultant(consultantModel) == Shared.Helpers.DbStatusCode.Updated)
                    {
                        TempData["ConsultantActionResponse"] = true;
                    }
                    else
                    {
                        TempData["ConsultantActionResponse"] = false;
                    }
                }
            }
            else
            {
                return(View(consultantModel));
            }

            return(RedirectToAction("Index"));
        }