un positionnement de paramètre workflow des pros
This commit is contained in:
@ -3,25 +3,19 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Workflow;
|
||||
|
||||
namespace Yavsc.Helpers {
|
||||
public static class ListItemHelpers {
|
||||
|
||||
public static List<SelectListItem> ActivityItems(
|
||||
this ApplicationDbContext _dbContext, string selectedCode)
|
||||
this ApplicationDbContext _dbContext, List<UserActivity> activity)
|
||||
{
|
||||
var codeIsNull = (string.IsNullOrEmpty(selectedCode));
|
||||
List<SelectListItem> items;
|
||||
if (codeIsNull) items = _dbContext.Activities.Select(
|
||||
List<SelectListItem> items = _dbContext.Activities.Select(
|
||||
x=> new SelectListItem() {
|
||||
Value=x.Code, Text=x.Name
|
||||
} ).ToList();
|
||||
else items =
|
||||
_dbContext.Activities.Select(
|
||||
x=> new SelectListItem() {
|
||||
Value=x.Code, Text=x.Name,
|
||||
Selected = (x.Code == selectedCode)
|
||||
Value = x.Code, Text = x.Name, Selected = activity.Any(a=>a.DoesCode == x.Code)
|
||||
} ).ToList();
|
||||
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user