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)); } }
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)); }