public ActionResult Details(int id)
        {
            var city      = cityRepository.Get(id);
            var viewModel = new CityFormViewModel
            {
                City = city
            };

            return(View(viewModel));
        }
Example #2
0
        public IHttpActionResult Get()
        {
            try
            {
                IQueryable <City> city = null;
                city = _repository.Get();

                return(Ok(city
                          .OrderBy(d => d.Id)
                          .ToList()));
            }
            catch (Exception ex)
            {
                return(InternalServerError());
            }
        }
        public HttpResponseMessage GetCity(int id)
        {
            CityDTO ObjCt = CityRep.Get(id);

            if (ObjCt == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Sorry"));
            }
            else
            {
                return(Request.CreateResponse <CityDTO>(ObjCt));
            }
        }
Example #4
0
        public IActionResult GetCities(long id)
        {
            var response = new ResponseModel {
                Message = "OK", Success = true
            };

            try
            {
                response.Result = cityBO.Get(j => j.IdDepartment == id);
            }
            catch (Exception ex)
            {
                logger.LogError(ex, ex.Message);
                return(Json(new ResponseModel {
                    Message = ex.Message, Success = false
                }));
            }

            return(Json(response));
        }