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)); } }
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)); } }
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); } }
public void OnResponse_Role_Model(MemoryStream stream, int uid = 0) { Role_Model Role_Model = ProtoBuf.Serializer.Deserialize <Role_Model>(stream); Parser.Parse(Role_Model); }
public int Save_Update_Delete_Role(Role_Model _role) { return(obj.Save_Update_Delete_Role(_role)); }