Пример #1
0
 //post - הוספת דייר
 public IHttpActionResult Post([FromBody] Tenant t)
 {
     try
     {
         TenantBL.AddTenant(t);
         return(Ok());
     }
     catch
     {
         throw;
     }
 }
Пример #2
0
 public HttpResponseMessage UpdateTenantDetails(Tenant tenant)
 {
     try
     {
         TenantBL.UpdateTenantDetails(tenant);
         return(Request.CreateResponse(HttpStatusCode.OK, true));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex));
     }
 }
Пример #3
0
 public HttpResponseMessage GetNumTenant(int buildingId)
 {
     try
     {
         int numTenant = TenantBL.GetAllTenantByBuilding(buildingId).Count;
         return(Request.CreateResponse(HttpStatusCode.OK, numTenant));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex));
     }
 }
Пример #4
0
 public HttpResponseMessage Post(Tenant t)
 {
     try
     {
         //t.user_id = UserBL.AddUser(new User() { password = t.password, user_name = t.mail });
         TenantBL.AddTenant(t);
         return(Request.CreateResponse(HttpStatusCode.OK, true));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex));
     }
 }
Пример #5
0
        public HttpResponseMessage AddNotificationForAllUsers(NotificationForUser userNotification)
        {
            int id = NotificationBL.AddNotification(userNotification.message);

            if (id != -1)
            {
                List <tenant_tbl> tenants = TenantBL.GetAllTenantByBuilding(userNotification.userId);
                foreach (var t in tenants)
                {
                    NotificationBL.AddNotificationForUser(t.user_id, id);
                }

                return(Request.CreateResponse(HttpStatusCode.OK, true));
            }
            return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, true));
        }
Пример #6
0
 public Tenant Get(int id)
 {
     return(TenantBL.GetById(id));
 }
Пример #7
0
 public List <Tenant> Get()
 {
     return(TenantBL.GetAll());
 }
Пример #8
0
 public HttpResponseMessage RemoveTenant(Tenant t)
 {
     TenantBL.RemoveTenant(t);
     return(Request.CreateResponse(HttpStatusCode.OK, true));
 }
Пример #9
0
        public HttpResponseMessage GetAllTenantByBuildingId(int buildingId)
        {
            List <Tenant> t = TenantBL.GetAllTenantByBuildingId(buildingId);

            return(Request.CreateResponse(HttpStatusCode.OK, t));
        }
Пример #10
0
        public HttpResponseMessage GetTenant(int userId)
        {
            Tenant t = TenantBL.GetTenantByUserId(userId);

            return(Request.CreateResponse(HttpStatusCode.OK, t));
        }