//post - הוספת דייר public IHttpActionResult Post([FromBody] Tenant t) { try { TenantBL.AddTenant(t); return(Ok()); } catch { throw; } }
public HttpResponseMessage UpdateTenantDetails(Tenant tenant) { try { TenantBL.UpdateTenantDetails(tenant); return(Request.CreateResponse(HttpStatusCode.OK, true)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex)); } }
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 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)); } }
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)); }
public Tenant Get(int id) { return(TenantBL.GetById(id)); }
public List <Tenant> Get() { return(TenantBL.GetAll()); }
public HttpResponseMessage RemoveTenant(Tenant t) { TenantBL.RemoveTenant(t); return(Request.CreateResponse(HttpStatusCode.OK, true)); }
public HttpResponseMessage GetAllTenantByBuildingId(int buildingId) { List <Tenant> t = TenantBL.GetAllTenantByBuildingId(buildingId); return(Request.CreateResponse(HttpStatusCode.OK, t)); }
public HttpResponseMessage GetTenant(int userId) { Tenant t = TenantBL.GetTenantByUserId(userId); return(Request.CreateResponse(HttpStatusCode.OK, t)); }