Example #1
0
        public ActionResult IndexJq()
        {
            var repo = new OmbudsmanDb.OmbudsmanRepository();
            var facilities = repo.GetFacilityTypes();
            ViewBag.FacilityTypeId = new SelectList(facilities, "FacilityTypeId", "Name");
            ViewBag.IsManager = System.Web.Security.Roles.IsUserInRole("Manager");

            return View();
        }
 // PUT api/ombudsman/5
 public void Put(int id, Ombudsman.Models.Ombudsman value)
 {
     var repo = new OmbudsmanDb.OmbudsmanRepository();
     var result = repo.UpdateOmbudsman(value, System.Web.Security.Roles.IsUserInRole("Manager"));
     if (!result)
     {
         throw new HttpResponseException(HttpStatusCode.Unauthorized);
     }
 }
 // PUT api/facility/5
 public void Put(int id, Ombudsman.Models.Facility facility)
 {
     var repo = new OmbudsmanDb.OmbudsmanRepository();
     facility.OmbudsmanId = repo.GetOmbudsmanIdFromName(facility.OmbudsmanName);
     var result = repo.UpdateFacility(facility, System.Web.Security.Roles.IsUserInRole("Manager"));
     if (!result)
     {
         throw new HttpResponseException(HttpStatusCode.Unauthorized);
     }
 }
 public void Post(Ombudsman.Models.Ombudsman value)
 {
     var repo = new OmbudsmanDb.OmbudsmanRepository();
     repo.CreateOmbudsman(value);
 }
 // GET api/ombudsman/5
 public Ombudsman.Models.Ombudsman Get(int id)
 {
     var repo = new OmbudsmanDb.OmbudsmanRepository();
     return repo.GetOmbudsman(id);
 }
 // GET api/ombudsman
 public IEnumerable<Ombudsman.Models.Ombudsman> Get()
 {
     var repo = new OmbudsmanDb.OmbudsmanRepository();
     return repo.GetOmbudsmen();
 }
 // GET api/facilitytype
 public IEnumerable<Ombudsman.Models.FacilityType> Get()
 {
     var repo = new OmbudsmanDb.OmbudsmanRepository();
     return repo.GetFacilityTypes();
 }
 public void Post(Ombudsman.Models.Facility facility)
 {
     var repo = new OmbudsmanDb.OmbudsmanRepository();
     facility.OmbudsmanId = repo.GetOmbudsmanIdFromName(facility.OmbudsmanName);
     repo.CreateFacility(facility);
 }
 // GET api/facility/5
 public Ombudsman.Models.Facility Get(int id)
 {
     var repo = new OmbudsmanDb.OmbudsmanRepository();
     return repo.GetFacility(id);
 }