Ejemplo n.º 1
0
 // 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);
     }
 }
Ejemplo n.º 2
0
 // 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);
     }
 }
Ejemplo n.º 3
0
        public ActionResult CreateUser(Ombudsman.Models.NewUser user)
        {
            try
            {
                var memres = Membership.CreateUser(user.Username, user.Password, user.Email);
                if (user.IsManager)
                {
                    Roles.AddUserToRole(user.Username, "Manager");
                }

                return this.Content("okay", "text/plain");
            }
            catch (Exception ex)
            {
                return this.Content("could not create user " + ex.Message, "text/plain");
            }
        }
Ejemplo n.º 4
0
 public void Post(Ombudsman.Models.Ombudsman value)
 {
     var repo = new OmbudsmanDb.OmbudsmanRepository();
     repo.CreateOmbudsman(value);
 }
Ejemplo n.º 5
0
 public void Post(Ombudsman.Models.Facility facility)
 {
     var repo = new OmbudsmanDb.OmbudsmanRepository();
     facility.OmbudsmanId = repo.GetOmbudsmanIdFromName(facility.OmbudsmanName);
     repo.CreateFacility(facility);
 }