Exemplo n.º 1
0
        public async Task <IActionResult> Add()
        {
            try
            {
                var model = new AddressEntityViewModel();
                if (model != null)
                {
                    ViewBag.CountryList = await _iAddressManager.GetCountryEntitysAsync();

                    ViewBag.StateList = await _iAddressManager.GetStateEntitysAsync();

                    return(View("AddOrEdit", model));
                }
                else
                {
                    this.FlashError(ExceptionHelper.ExceptionErrorMessageForNullObject(), "AddressMessage");
                    return(RedirectToAction("Index", "Address"));
                }
            }
            catch (Exception ex)
            {
                _log.Error(LogMessageHelper.FormateMessageForException(ex, "Add[GET]"));
            }

            this.FlashError(MessageHelper.UnhandelledError, "AddressMessage");
            return(RedirectToAction("Index", "Address"));
        }
        public async Task <IActionResult> GetAllState()
        {
            try
            {
                _log.Info(LogMessageHelper.FormateMessageForStart("GetAllState[GET]"));

                var response = await _iAddressManager.GetStateEntitysAsync();

                return(Ok(response));
            }
            catch (Exception ex)
            {
                _log.Error(LogMessageHelper.FormateMessageForException(ex, "GetAllState[GET]"));
            }

            return(BadRequest(MessageHelper.NullReferenceExceptionError));
        }