public AddApartmentResponse AddApartment(AddApartmentRequest request)
        {
            AdministrationServiceDAO adminDAO = new AdministrationServiceDAO();
            bool result = adminDAO.AddApartment(request.apartment);

            return(new AddApartmentResponse(result));
        }
Exemplo n.º 2
0
        public AddApartmentResponse AddApartment(AddApartmentRequest request)
        {
            AdministrationServiceDAO adminDAO = new AdministrationServiceDAO();
            int resultId = adminDAO.AddApartment(request.apartment);

            if (resultId != -1)
            {
                return(new AddApartmentResponse(true, resultId));
            }
            else
            {
                ThrowDatabaseAccessException();
                return(null);
            }
        }
Exemplo n.º 3
0
        public string AddApartment()
        {
            string    body     = GetBody();
            apartment ap       = JsonConvert.DeserializeObject <apartment>(body);
            Response  response = new Response();

            if (ap != null)
            {
                AdministrationServiceDAO adminDAO = new AdministrationServiceDAO();
                if (adminDAO.AddApartment(ap) != -1)
                {
                    response.status = "ok";
                }
                else
                {
                    response.status = "failed";
                }
            }
            else
            {
                response.status = "failed";
            }
            return(JsonConvert.SerializeObject(response));
        }