Esempio n. 1
0
 public HttpResponseMessage UpdateRole(Role_Model _role)
 {
     try
     {
         int id = objRole.Save_Update_Delete_Role(_role);
         if (id > 0)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, id));
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.MultipleChoices, "Role already exists"));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
Esempio n. 2
0
 public HttpResponseMessage DeleteRole(Role_Model _role)
 {
     try
     {
         int id = objRole.Save_Update_Delete_Role(_role);
         if (id > 0)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, id));
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound, "Role not found."));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
Esempio n. 3
0
        public int Save_Update_Delete_Role(Role_Model _role)
        {
            int id = 0;

            try
            {
                cmd             = new SqlCommand("Role", cmd.Connection);
                cmd.Connection  = DbConnect.CreateConnection();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@RoleId", _role.RoleId);
                cmd.Parameters.AddWithValue("@Role", _role.Role);
                cmd.Parameters.AddWithValue("@Action", _role.Action);
                cmd.Connection.Open();
                id = Convert.ToInt32(cmd.ExecuteScalar());
                cmd.Connection.Close();
                return(id);
            }
            catch (Exception ex)
            {
                return(id);
            }
        }
Esempio n. 4
0
        public void OnResponse_Role_Model(MemoryStream stream, int uid = 0)
        {
            Role_Model Role_Model = ProtoBuf.Serializer.Deserialize <Role_Model>(stream);

            Parser.Parse(Role_Model);
        }
Esempio n. 5
0
 public int Save_Update_Delete_Role(Role_Model _role)
 {
     return(obj.Save_Update_Delete_Role(_role));
 }