Ejemplo n.º 1
0
        public IActionResult Get(CancellationToken cancellationToken)
        {
            _logger.LogInformation("Building/Get was requested.");
            var response = _buildingService.Get(cancellationToken);

            return(Ok(_mapper.Map <IEnumerable <BuildingResponse> >(response)));
        }
 public ActionResult Get(int id)
 {
     try
     {
         var buildings = _buildingService.Get(id);
         response.StatusCode = StatusCodes.Status200OK;
         response.Status     = "OK";
         response.Result     = buildings;
         return(Ok(response));
     }
     catch (Exception e)
     {
         response.StatusCode = StatusCodes.Status400BadRequest;
         response.Status     = "BAD REQUEST";
         response.Message    = e.Message;
         return(BadRequest(response));
     }
 }
        public IActionResult Get()
        {
            Answer answer = new Answer();

            try
            {
                answer.Data       = _buildingService.Get();
                answer.Successful = true;
            }
            catch (Exception err)
            {
                answer.Message = err.Message;
            }

            return(Ok(answer));
        }
Ejemplo n.º 4
0
        public object GetAll()
        {
            var output = new ResponseDetail();

            try
            {
                var buildingList = _buildingService.Get();
                output.Data    = buildingList;
                output.Success = true;
                return(output);
            }
            catch (Exception ex)
            {
                output.Success = false;
                output.Message = ex.Message;
                return(output);
            }
        }
Ejemplo n.º 5
0
        public async Task <ProfileView> Handler(Guid tenatId, CancellationToken cancellationToken)
        {
            var tenant = await repository.Get(tenatId, cancellationToken);

            var building = await buildingService.Get(tenant.BuildingId, cancellationToken);

            return(new ProfileView()
            {
                Id = tenant.TenantId,
                Name = tenant.Name,
                Surname = tenant.Surname,
                Address = building.Address,
                EntranceNumber = tenant.EntranceNumber,
                FlatNumber = tenant.FlatNumber,
                Avatar = tenant.Avatar,
                NameManagmentCompany = await buildingService.GetNameOfManagmantCompany(building, cancellationToken),
                HasMeeting = building.MeetId
            });
        }
Ejemplo n.º 6
0
        public async Task <Tenant> Create(string name,
                                          string surname,
                                          string paaword,
                                          DateTime dateOfBirth,
                                          string address,
                                          int entranceNumber,
                                          int flatNumber,
                                          CancellationToken cancellationToken)
        {
            var building = await buildingService.Get(address, cancellationToken);

            if (building == null)
            {
                throw new BuildingWithSuchAddressNotRegisteredException(address);
            }

            return(new Tenant(name,
                              surname,
                              paaword,
                              dateOfBirth,
                              building.BuildingId,
                              entranceNumber,
                              flatNumber));
        }
Ejemplo n.º 7
0
 public ActionResult <Building> Get(int id)
 {
     return(Ok(buildingService.Get(id)));
 }
        public object GetBuilding(string buildingId)
        {
            var data = _buildingService.Get(buildingId);

            return(data);
        }