Example #1
0
 public HttpResponseMessage GetById(HttpRequestMessage request, int id)
 {
     return(CreateHttpResponse(request, () =>
     {
         var model = _apartmentService.GetById(id);
         var responseData = Mapper.Map <Apartment, ApartmentViewModel>(model);
         var response = request.CreateResponse(HttpStatusCode.OK, responseData);
         return response;
     }));
 }
Example #2
0
        public IActionResult GetById(int id)
        {
            var result = _customerService.GetById(id);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
        public ActionResult Edit(Guid id)
        {
            if (InvalidGuid(id))
            {
                return(StatusCode(404));
            }

            var building = _buildingService.GetByOwnerAndApartmentId(User.FindFirstValue(ClaimTypes.NameIdentifier), id);

            if (building == null)
            {
                return(StatusCode(404));
            }

            var apartment = _apartmentService.GetById(id);

            if (apartment == null)
            {
                return(StatusCode(404));
            }
            return(View(new ApartmentModel(apartment, building.Id)));
        }
 public async Task <IActionResult> Edit(string id)
 {
     ViewBag.LocationId = new SelectList(await _locationService.GetAll(), "LocationId", "Address");
     return(View(_apartmentService.GetById(id)));
 }
 public async Task <ApartmentViewModel> GetById(Guid id)
 {
     return(await _apartmentService.GetById(id));
 }