Пример #1
0
        public ApiResponseModel <MoviesType> GetById([FromBody] GetByIdRequestModel requestModel)
        {
            var responseModel = new ApiResponseModel <MoviesType>();

            try
            {
                responseModel.Data                = _moviesTypeService.GetById(requestModel.Id);
                responseModel.ResultStatusCode    = ResultStatusCodeStatic.Success;
                responseModel.ResultStatusMessage = "Success";
            }
            catch (Exception ex)
            {
                responseModel.ResultStatusCode    = ResultStatusCodeStatic.Error;
                responseModel.ResultStatusMessage = ex.Message;
            }

            return(responseModel);
        }
Пример #2
0
        public ActionResult Edit(int id)
        {
            Models.MoviesType.AddViewModel model = new AddViewModel();
            //select lists
            var apiResponseModel = _moviesTypeService.GetById(SessionHelper.CurrentUser.UserToken, id);

            if (apiResponseModel.ResultStatusCode != ResultStatusCodeStatic.Success)
            {
                ViewBag.ErrorMessage = apiResponseModel.ResultStatusMessage;
                return(View(model));
            }
            var moviesType = apiResponseModel.Data;

            if (moviesType == null)
            {
                return(View("_ErrorNotExist"));
            }
            model.Id   = moviesType.Id;
            model.Name = moviesType.Name;
            return(View(model));
        }