Ejemplo n.º 1
0
        /// <summary>
        /// 获取题目统计信息
        /// </summary>
        /// <param name="cid">竞赛ID</param>
        /// <param name="pid">题目ID</param>
        /// <returns>题目统计信息实体</returns>
        public static ProblemStatistic GetProblemStatistic(Int32 cid, Int32 pid)
        {
            //此处不能验证cid,因为普通Problem的Statistic也经由此方法

            if (pid < ConfigurationManager.ProblemSetStartID)
            {
                throw new InvalidRequstException(RequestType.Problem);
            }

            //验证pid有效性
            if (cid < 0)//非竞赛题目
            {
                ProblemEntity entity = ProblemManager.GetProblem(pid);
                pid = entity.ProblemID;
            }
            else//竞赛题目
            {
                ProblemEntity entity = ContestProblemManager.GetProblem(cid, pid);
                //竞赛题目传入的pid是ContestProblemID
            }

            ProblemStatistic statistic = SolutionCache.GetProblemStatisticCache(cid, pid);

            if (statistic == null)
            {
                statistic = SolutionRepository.Instance.GetProblemStatistic(cid, pid);//一定有返回值
            }

            return(statistic);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 在主题目库中创建一道新题目并返回该题目的句柄。
        /// </summary>
        /// <returns>创建的题目句柄。</returns>
        /// <exception cref="ArgumentNullException"/>
        /// <exception cref="ProblemAlreadyExistException"/>
        public ProblemHandle CreateProblem(string problemId)
        {
            if (problemId == null)
            {
                throw new ArgumentNullException(nameof(problemId));
            }
            if (IsProblemExist(problemId))
            {
                throw new ProblemAlreadyExistException(new ProblemHandle(problemId));
            }

            // 为题目创建文件系统目录。
            string directory = string.Concat(ms_archieveDirectory, "\\", problemId);

            Directory.CreateDirectory(directory);

            ProblemEntity entity = new ProblemEntity()
            {
                Id = problemId,
                ProblemDirectory = directory,
            };

            // 将题目实体对象添加至底层数据库中。
            m_factory.WithContext(context =>
            {
                context.AddProblemEntity(entity);
                context.SaveChanges();
            });

            // 创建句柄并返回。
            ProblemHandle handle = ProblemHandle.FromProblemEntity(entity);

            return(handle);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 向缓存中写入指定题目信息
 /// </summary>
 /// <param name="problem">指定题目信息</param>
 public static void SetProblemCache(ProblemEntity problem)
 {
     if (problem != null)
     {
         CacheManager.Set(GetProblemCacheKey(problem.ProblemID), problem, PROBLEM_CACHE_TIME);
     }
 }
        /// <summary>
        /// 从给定的题目句柄对象创建 NativeProblemDataProvider 对象。
        /// </summary>
        /// <param name="handle">题目句柄对象。</param>
        /// <param name="isReadonly">一个值,该值指示创建的 NativeProblemDataProvider 对象是否处于只读模式。</param>
        /// <returns>从给定题目句柄创建的 NativeProblemDataProvider 对象。</returns>
        /// <exception cref="ArgumentNullException"/>
        /// <exception cref="InvalidProblemException"/>
        /// <exception cref="ProblemNotExistException"/>
        public static ProblemDataProvider Create(ProblemHandle handle, bool isReadonly)
        {
            if (handle == null)
            {
                throw new ArgumentNullException(nameof(handle));
            }
            if (!handle.IsNativeProblem)
            {
                throw new InvalidProblemException(handle, "给定的题目句柄不是 BITOJ 本地题目。");
            }

            // 从底层数据库中查询题目实体对象。
            ProblemDataContext context = new ProblemDataContextFactory().CreateContext();
            ProblemEntity      entity  = context.GetProblemEntityById(handle.ProblemId);

            if (entity == null)
            {
                context.Dispose();
                throw new ProblemNotExistException(handle);
            }

            // 创建底层题目数据访问器对象。
            ProblemAccessHandle entryHandle = new ProblemAccessHandle(entity);

            return(new ProblemDataProvider()
            {
                m_context = context,
                m_entity = entity,
                m_accessHandle = entryHandle,
                m_readonly = isReadonly
            });
        }
        /// <summary>
        /// 从给定的题目句柄对象创建 NativeProblemDataProvider 对象。
        /// </summary>
        /// <param name="handle">题目句柄对象。</param>
        /// <param name="isReadonly">一个值,该值指示创建的 NativeProblemDataProvider 对象是否处于只读模式。</param>
        /// <returns>从给定题目句柄创建的 NativeProblemDataProvider 对象。</returns>
        /// <exception cref="ArgumentNullException"/>
        /// <exception cref="InvalidProblemException"/>
        /// <exception cref="ProblemNotExistException"/>
        public static NativeProblemDataProvider Create(ProblemHandle handle, bool isReadonly)
        {
            if (handle == null)
            {
                throw new ArgumentNullException(nameof(handle));
            }
            if (!handle.IsNativeProblem)
            {
                throw new InvalidProblemException(handle, "给定的题目句柄不是 BITOJ 本地题目。");
            }

            // 尝试从题目句柄中解析出题目ID。
            if (!int.TryParse(handle.ProblemId.Substring(3), out int id))
            {
                throw new InvalidProblemException(handle, "给定的题目句柄非法。");
            }

            // 从底层数据库中查询题目实体对象。
            ProblemEntity entity = ProblemArchieveManager.Default.DataContext.GetProblemEntityById(id);

            if (entity == null)
            {
                throw new ProblemNotExistException(handle);
            }

            // 创建底层题目数据访问器对象。
            ProblemAccessHandle entryHandle = new ProblemAccessHandle(entity.ProblemDirectory);

            return(new NativeProblemDataProvider()
            {
                m_entity = entity,
                m_accessHandle = entryHandle,
                m_readonly = isReadonly
            });
        }
 /// <summary>
 /// 初始化 NativeProblemDataProvider 类的新实例。
 /// </summary>
 private NativeProblemDataProvider()
 {
     m_entity       = null;
     m_accessHandle = null;
     m_readonly     = true;
     m_disposed     = false;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 尝试将Free Problem Set导出为题目实体和题目数据包
        /// </summary>
        /// <param name="fps">Free Problem Set</param>
        /// <param name="problems">题目实体</param>
        /// <param name="datas">题目数据包</param>
        /// <param name="images">图形文件列表</param>
        /// <returns>是否导入成功</returns>
        public static Boolean TryImportFreeProblemSet(FreeProblemSet fps, out List <ProblemEntity> problems, out List <Byte[]> datas, out List <Dictionary <String, Byte[]> > images)
        {
            if (fps == null || fps.Count < 1)
            {
                problems = null;
                datas    = null;
                images   = null;

                return(false);
            }

            problems = new List <ProblemEntity>();
            datas    = new List <Byte[]>();
            images   = new List <Dictionary <String, Byte[]> >();

            for (Int32 i = 0; i < fps.Count; i++)
            {
                ProblemEntity problem = FreeProblemParser.ConvertFreeProblemToProblem(fps[i]);
                Byte[]        data    = FreeProblemParser.ConvertFreeProblemDataToZipFile(fps[i].TestData);
                Dictionary <String, Byte[]> fpimages = FreeProblemParser.ConvertFreeProblemImagesToBytes(fps[i].Images);

                problems.Add(problem);
                datas.Add(data);
                images.Add(fpimages);
            }

            return(true);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// 向缓存中写入指定竞赛题目信息
 /// </summary>
 /// <param name="cid">竞赛ID</param>
 /// <param name="pid">题目ID</param>
 /// <param name="problem">竞赛题目信息</param>
 public static void SetContestProblemCache(Int32 cid, Int32 pid, ProblemEntity problem)
 {
     if (problem != null)
     {
         CacheManager.Set(GetContestProblemCacheKey(cid, pid), problem, CONTEST_PROBLEM_CACHE_TIME);
     }
 }
Ejemplo n.º 9
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here
                var db = new ApplicationDbContext();

                ProblemEntity problem = new ProblemEntity
                {
                    Author            = collection["Author"],
                    In                = collection["In"],
                    Out               = collection["Out"],
                    MemoryLimitKb     = Int32.Parse(collection["MemoryLimitKb"].ToString()),
                    TymeLimitMs       = Int32.Parse(collection["TymeLimitMs"].ToString()),
                    Name              = collection["Name"],
                    Text              = collection["Text"],
                    ApplicationUserId = User.Identity.GetUserId()
                };

                db.ProblemEntities.Add(problem);
                db.SaveChanges();

                return(RedirectToAction("Details", new { id = problem.Id }));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 10
0
        public ActionResult Submit(Int32 id, FormCollection form)
        {
            ContestEntity contest = ViewData["Contest"] as ContestEntity;
            ProblemEntity problem = ContestProblemManager.GetProblem(contest.ContestID, id);

            SolutionEntity entity = new SolutionEntity()
            {
                ProblemID        = problem.ProblemID,
                ContestID        = contest.ContestID,
                ContestProblemID = id,
                SourceCode       = form["code"],
                LanguageType     = LanguageType.FromLanguageID(form["lang"])
            };

            Dictionary <String, Byte> supportLanguages = LanguageManager.GetSupportLanguages(contest.SupportLanguage);

            if (!supportLanguages.ContainsValue(entity.LanguageType.ID))
            {
                return(RedirectToErrorMessagePage("This contest does not support this programming language."));
            }

            String userip = this.GetCurrentUserIP();

            if (!SolutionManager.InsertSolution(entity, userip))
            {
                return(RedirectToErrorMessagePage("Failed to submit your solution!"));
            }

            return(RedirectToAction("List", "Status", new { area = "Contest", cid = contest.ContestID }));
        }
Ejemplo n.º 11
0
        public static IProblem AsDomainModelResolved(this ProblemEntity entity, Graph graph = null)
        {
            if (entity is MinimumVertexCoverEntity)
            {
                return(((MinimumVertexCoverEntity)entity).AsDomainModel(graph));
            }

            throw new MappingNotImplementedException(entity);
        }
Ejemplo n.º 12
0
        public ActionResult Submit(Int32 id = -1)
        {
            ProblemEntity problem = ProblemManager.GetProblem(id);
            IEnumerable <SelectListItem> items = this.GetLanguageItems();

            ViewBag.Languages = items;

            return(View(problem));
        }
Ejemplo n.º 13
0
        public ActionResult Show(Int32 id = -1)
        {
            ContestEntity contest = ViewData["Contest"] as ContestEntity;
            ProblemEntity entity  = ContestProblemManager.GetProblem(contest.ContestID, id);

            ViewBag.ContestProblemID = id.ToString();

            return(View(entity));
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 将给定的题目实体对象添加至数据集中。
        /// </summary>
        /// <param name="entity">要添加的题目实体对象。</param>
        /// <exception cref="ArgumentNullException"/>
        public void AddProblemEntity(ProblemEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            Problems.Add(entity);
            SaveChanges();
        }
Ejemplo n.º 15
0
 private static IndividualEntity AsEntityModel(this Individual model, GraphEntity graph, ProblemEntity problem)
 {
     return new IndividualEntity
     {
         Id = model.Id,
         Graph = graph,
         Problem = problem,
         CurrentSolution = model.CurrentSolution.Select(Convert.ToByte).ToArray()
     };
 }
Ejemplo n.º 16
0
        /// <summary>
        /// 更新缓存中题目通过数
        /// </summary>
        /// <param name="id">题目ID</param>
        /// <param name="count">通过数(自增为-1)</param>
        public static void UpdateProblemCacheSolvedCount(Int32 id, Int32 count)
        {
            ProblemEntity problem = GetProblemCache(id);

            if (problem != null)
            {
                problem.SolvedCount = (count < 0 ? problem.SolvedCount + 1 : count);
                SetProblemCache(problem);
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 题目添加页面
        /// </summary>
        /// <returns>操作后的结果</returns>
        public ActionResult Add()
        {
            ProblemEntity entity = new ProblemEntity()
            {
                TimeLimit   = 1000,
                MemoryLimit = 32768
            };

            return(View("Edit", entity));
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 由给定的题目 ID 获取题目句柄对象。
        /// </summary>
        /// <param name="id">题目 ID。</param>
        /// <returns>具有给定题目 ID 的题目句柄对象。若主题库中不存在这样的题目,返回 null。</returns>
        public ProblemHandle GetProblemById(int id)
        {
            ProblemEntity entity = m_context.GetProblemEntityById(id);

            if (entity == null)
            {
                return(null);
            }

            return(ProblemHandle.FromProblemEntity(entity));
        }
Ejemplo n.º 19
0
        public ActionResult Submit(Int32 id = -1)
        {
            ContestEntity contest = ViewData["Contest"] as ContestEntity;
            ProblemEntity problem = ContestProblemManager.GetProblem(contest.ContestID, id);
            IEnumerable <SelectListItem> items = this.GetLanguageItems(contest.SupportLanguage);

            ViewBag.Languages        = items;
            ViewBag.ContestProblemID = id.ToString();

            return(View(problem));
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 使用给定的题目实体对象初始化 ProblemEntryHandle 类的新实例。
        /// </summary>
        /// <param name="entity">题目实体对象。</param>
        /// <exception cref="ArgumentNullException"/>
        public ProblemAccessHandle(ProblemEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            m_problemDirectory = entity.ProblemDirectory;
            m_parts            = new Dictionary <ProblemParts, string>();
            m_disposed         = false;
            m_dirty            = false;
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 增加一条提交
        /// </summary>
        /// <param name="entity">对象实体</param>
        /// <param name="userip">用户IP</param>
        /// <returns>是否成功增加</returns>
        public static Boolean InsertSolution(SolutionEntity entity, String userip)
        {
            if (!UserManager.IsUserLogined)
            {
                throw new UserUnLoginException();
            }

            if (String.IsNullOrEmpty(entity.SourceCode) || entity.SourceCode.Length < SolutionRepository.SOURCECODE_MINLEN)
            {
                throw new InvalidInputException("Code is too short!");
            }

            if (entity.SourceCode.Length > SolutionRepository.SOURCECODE_MAXLEN)
            {
                throw new InvalidInputException("Code is too long!");
            }

            if (LanguageType.IsNull(entity.LanguageType))
            {
                throw new InvalidInputException("Language Type is INVALID!");
            }

            if (!UserSubmitStatus.CheckLastSubmitSolutionTime(UserManager.CurrentUserName))
            {
                throw new InvalidInputException(String.Format("You can not submit code more than twice in {0} seconds!", ConfigurationManager.SubmitInterval.ToString()));
            }

            ProblemEntity problem = ProblemManager.InternalGetProblemModel(entity.ProblemID);

            if (problem == null)//判断题目是否存在
            {
                throw new NullResponseException(RequestType.Problem);
            }

            if (entity.ContestID <= 0 && problem.IsHide && !AdminManager.HasPermission(PermissionType.ProblemManage))//非竞赛下判断是否有权访问题目
            {
                throw new NoPermissionException("You have no privilege to submit the problem!");
            }

            entity.UserName   = UserManager.CurrentUserName;
            entity.SubmitTime = DateTime.Now;
            entity.SubmitIP   = userip;

            Boolean success = SolutionRepository.Instance.InsertEntity(entity) > 0;

            if (success)
            {
                ProblemCache.UpdateProblemCacheSubmitCount(entity.ProblemID, -1);//更新缓存
                SolutionCache.RemoveProblemIDListCache(entity.UserName, true);
            }

            return(success);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 判断给定的题目是否已经存在于数据库中。
        /// </summary>
        /// <param name="problemId">题目编号。</param>
        /// <returns>一个值,该值指示题目是否已经存在于数据库中。</returns>
        /// <exception cref="ArgumentNullException"/>
        public bool IsProblemExist(string problemId)
        {
            if (problemId == null)
            {
                throw new ArgumentNullException(nameof(problemId));
            }

            return(m_factory.WithContext(context =>
            {
                ProblemEntity entity = context.GetProblemEntityById(problemId);
                return entity != null;
            }));
        }
Ejemplo n.º 23
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    ///harcoded
                    var db      = new ApplicationDbContext();
                    var problem = new ProblemEntity
                    {
                        Id                = 1,
                        Name              = "A+b",
                        MemoryLimitKb     = 100,
                        Text              = "DatoriiTatal si mama lui Gigel se ocupa cu vanzarea de sisteme de calcul.Afacerea s - a dovedit a fi foarte profitabila datorita unui sistem incredibil de creditare a clientilor: un client care cumpara un calculator in ziua X(in acest moment au trecut N zile de la infiintarea magazinului, zilele se numeroteaza de la 1 la N, 0 < X ≤ N) poate returna banii oricand doreste acesta, neexistand o limita de timp impusa.Astfel, aproape in fiecare zi, la magazinul familiei se prezinta diversi clienti care achita integral sau partial un sistem de calcul cumparat in zilele anterioare.Deoarece vor sa inceapa o noua afacere, Mama si Tata doresc sa il insarcineze pe Gigel cu administrarea magazinului de calculatoare.",
                        In                = "4 4",
                        Out               = "8",
                        TymeLimitMs       = 1000,
                        Author            = "Vasile Catana",
                        ApplicationUserId = user.Id
                    };

                    db.ProblemEntities.Add(problem);
                    db.SaveChanges();
                    ///harcoded

                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return(RedirectToAction("Index", "Home"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 根据ID得到一个题目实体
        /// </summary>
        /// <param name="cid">竞赛ID</param>
        /// <param name="pid">题目ID</param>
        /// <returns>题目实体</returns>
        public static ProblemEntity GetProblem(Int32 cid, Int32 pid)
        {
            ProblemEntity problem = ContestProblemCache.GetContestProblemCache(cid, pid);//获取缓存

            if (problem == null)
            {
                problem = ProblemRepository.Instance.GetEntityForContest(cid, pid);
                ContestProblemCache.SetContestProblemCache(cid, pid, problem);//设置缓存
            }

            if (problem == null)
            {
                throw new NullResponseException(RequestType.Problem);
            }

            return(problem);
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 在主题目库中创建一道新题目并返回该题目的句柄。
        /// </summary>
        /// <returns></returns>
        public ProblemHandle CreateProblem()
        {
            ProblemEntity entity = new ProblemEntity();

            // 为题目创建文件系统目录。
            string directory = string.Concat(ms_archieveDirectory, "\\", entity.Id.ToString("D4"));

            Directory.CreateDirectory(directory);

            // 将题目实体对象添加至底层数据库中。
            m_context.AddProblemEntity(entity);

            // 创建句柄并返回。
            ProblemHandle handle = ProblemHandle.FromProblemEntity(entity);

            return(handle);
        }
Ejemplo n.º 26
0
        public ActionResult Add(FormCollection form)
        {
            ProblemEntity entity = new ProblemEntity()
            {
                Title        = form["title"],
                Description  = form["description"],
                Input        = form["input"],
                Output       = form["output"],
                SampleInput  = form["samplein"],
                SampleOutput = form["sampleout"],
                Hint         = form["hint"],
                Source       = form["source"],
                TimeLimit    = form["timelimit"].ToInt32(1000),
                MemoryLimit  = form["memorylimit"].ToInt32(32768)
            };

            return(ResultToMessagePage(ProblemManager.AdminInsertProblem, entity, "Your have added problem successfully!"));
        }
Ejemplo n.º 27
0
        /// <summary>
        /// 从题目库中删除给定的题目。
        /// </summary>
        /// <param name="problemId">要删除的题目的题目 ID。</param>
        /// <exception cref="ArgumentNullException"/>
        public void RemoveProblem(string problemId)
        {
            if (problemId == null)
            {
                throw new ArgumentNullException(nameof(problemId));
            }

            m_factory.WithContext(context =>
            {
                ProblemEntity entity = context.GetProblemEntityById(problemId);
                if (entity != null)
                {
                    // 删除本地文件系统文件。
                    Directory.Delete(entity.ProblemDirectory, true);
                    // 从数据库中移除。
                    context.RemoveProblemEntity(entity);
                }
            });
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 根据ID得到一个题目实体
        /// </summary>
        /// <param name="id">题目ID</param>
        /// <returns>题目实体</returns>
        internal static ProblemEntity InternalGetProblemModel(Int32 id)
        {
            ProblemEntity problem = ProblemCache.GetProblemCache(id);//获取缓存

            if (problem == null)
            {
                problem = ProblemRepository.Instance.GetEntity(id);

                if (problem != null)
                {
                    problem.SampleInput  = HtmlEncoder.HtmlEncode(problem.SampleInput);
                    problem.SampleOutput = HtmlEncoder.HtmlEncode(problem.SampleOutput);

                    ProblemCache.SetProblemCache(problem);//设置缓存
                }
            }

            return(problem);
        }
Ejemplo n.º 29
0
        // GET: Problem/Details/5
        public ActionResult Details(int id = 1, string name = "vasiok")
        {
            ProblemEntity problem = null;

            for (int i = 0; i < db.ProblemEntities.ToList().Count; ++i)
            {
                if (db.ProblemEntities.ToList()[i].Id == id || db.ProblemEntities.ToList()[i].Name == name)
                {
                    problem = db.ProblemEntities.ToList()[i];
                    break;
                }
            }

            if (problem != null)
            {
                return(View(problem));
            }

            return(HttpNotFound("Not such a problem"));
        }
Ejemplo n.º 30
0
        /// <summary>
        /// 由给定的题目 ID 获取题目句柄对象。
        /// </summary>
        /// <param name="id">题目 ID。</param>
        /// <returns>具有给定题目 ID 的题目句柄对象。若主题库中不存在这样的题目,返回 null。</returns>
        /// <exception cref="ArgumentNullException"/>
        public ProblemHandle GetProblemById(string id)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            return(m_factory.WithContext(context =>
            {
                ProblemEntity entity = context.GetProblemEntityById(id);
                if (entity == null)
                {
                    return null;
                }
                else
                {
                    return ProblemHandle.FromProblemEntity(entity);
                }
            }));
        }
Ejemplo n.º 31
0
        /// <summary>
        /// 根据ID得到一个题目实体
        /// </summary>
        /// <param name="id">题目ID</param>
        /// <returns>题目实体</returns>
        public static IMethodResult AdminGetProblem(Int32 id)
        {
            if (!AdminManager.HasPermission(PermissionType.ProblemManage))
            {
                throw new NoPermissionException();
            }

            if (id < ConfigurationManager.ProblemSetStartID)
            {
                return(MethodResult.InvalidRequest(RequestType.Problem));
            }

            ProblemEntity entity = ProblemRepository.Instance.GetEntity(id);

            if (entity == null)
            {
                return(MethodResult.NotExist(RequestType.Problem));
            }

            return(MethodResult.Success(entity));
        }
Ejemplo n.º 32
0
 public static IEnumerable<IndividualEntity> AsEntityModel(this IEnumerable<Individual> models, GraphEntity graph, ProblemEntity problem)
 {
     if (models == null) return new List<IndividualEntity>();
     return models.Where(m => m != null).Select(m => m.AsEntityModel(graph, problem));
 }