Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6153 for branches


Ignore:
Timestamp:
05/07/11 14:17:42 (13 years ago)
Author:
gschwarz
Message:

#1433 Updated Problem Control/View

Location:
branches/WebApplication/MVC2/HLWebOKBAdminPlugin
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Controllers/ProblemController.cs

    r6142 r6153  
    2525    }
    2626
     27        public ActionResult SortAsc() {
     28            Session["SelectedSubMenu"] = "Problem";
     29            ProblemModel pm = new ProblemModel();
     30            pm.Problems.OrderBy(x => x.Name);
     31            return View("Index",pm);
     32        }
     33
     34        public ActionResult SortDesc() {
     35            Session["SelectedSubMenu"] = "Problem";
     36            ProblemModel pm = new ProblemModel();
     37            pm.Problems.OrderByDescending(x => x.Name);
     38            return View("Index",pm);
     39        }
    2740        /// <summary>
    2841        /// Controller for Detail View
     
    3043        /// <param name="p"></param>
    3144        /// <returns></returns>
    32     public ActionResult Detail(long id)
     45    public ActionResult Detail(long? id)
    3346        {
    3447            Session["SelectedSubMenu"] = "Problem";
     
    3649            // we can also use the Problem class. (?)
    3750      ProblemModel pm = new ProblemModel();
    38             if(id == 0)
     51            if(id == null)
    3952                pm.Problem = new Problem();
    4053            else
    41                 pm.Problem = (Problem)pm.Problems.Where(x => x.Id.Equals(id)).FirstOrDefault();
     54                pm.Problem = (Problem)pm.Problems.Where(x => x.Id.Equals((long)id)).FirstOrDefault();
    4255      return View(pm);
    4356    }
     57
     58        public ActionResult Delete(long id) {
     59            Session["SelectedSubMenu"] = "Problem";
     60            // We use here the ProblemMode, but I think
     61            // we can also use the Problem class. (?)
     62            ProblemModel pm = new ProblemModel();
     63            if(id != 0) {
     64                pm.Problem = (Problem)pm.Problems.Where(x => x.Id.Equals(id)).FirstOrDefault();
     65//                pm.DeleteProblem();
     66            }
     67            return View(pm);
     68        }
    4469
    4570        public ActionResult SaveChanges(FormCollection collection) {           
  • branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Models/ProblemModel.cs

    r6142 r6153  
    5252        }
    5353
    54         public void CreateProblem(Problem problem) {
    55             AdministrationServiceClient adminClient = Admin.GetClientFactory("okbtester", "okbtester");
    56             adminClient.AddProblem(problem);
    57         }
    5854
    5955    }
  • branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Views/Problem/Detail.aspx

    r6142 r6153  
    6161                <select name="ProblemClassId">
    6262                    <% foreach(ProblemClass pc in ((ProblemModel)Model).ProblemClasses) {  %>
     63                        <% if(p.ProblemClassId == pc.Id) { %>
     64                            <option selected="selected" value="<%=pc.Id%>"><%=pc.Name%></option>
     65                        <% } else { %>
    6366                            <option value="<%=pc.Id%>"><%=pc.Name%></option>
     67                        <% } %>
    6468                    <% } %>
    6569                </select>
     
    7377                <select name="PlattformId">
    7478                    <% foreach(Platform pc in ((ProblemModel)Model).Plattforms) {  %>
     79                        <% if(p.PlatformId == pc.Id) { %>
     80                            <option selected="selected" value="<%=pc.Id%>"><%=pc.Name%></option>
     81                        <% } else { %>
    7582                            <option value="<%=pc.Id%>"><%=pc.Name%></option>
     83                        <% } %>
    7684                    <% } %>
    7785                </select>
  • branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Views/Problem/Index.aspx

    r6142 r6153  
    88<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    99    <h2>Problems</h2>
     10   
     11   
     12   
     13    <%  long? id = null;  %>
     14    <%: Html.ActionLink("New Problem", "Detail", new {id}) %>
     15    <%: Html.ActionLink("Order ASC", "SortAsc")%>
     16    <%: Html.ActionLink("Order DESC", "SortDesc")%>
     17
    1018    <div style="height:150px; overflow:scroll;">
    1119        <table>
     
    2230                    <%: Html.Label(p.DataTypeName)%>
    2331                </td>
     32                <td>
     33                     <%: Html.ActionLink("delete", "Detail",new {p.Id}) %>
     34                </td>
    2435            </tr>
    2536            <% } %>
    2637        </table>
    27     </div>
    28 
    29      
    30     <h2>Create new Problem</h2>
    31  
    32        
     38    </div>       
    3339</asp:Content>
Note: See TracChangeset for help on using the changeset viewer.