Esempio n. 1
0
        public FileStreamResult GetListPerson()
        {
            StringBuilder sb = new StringBuilder();

            foreach (var personItem in PersonHelper.PersonModelList)
            {
                var awardsIds =
                    PersonLinkAwardHelper.GetPersonLinkAwardList()
                    .Where(_ => _.PersonModelData.Id == personItem.Id)
                    .Select(_ => _.AwardModelData.Id)
                    .ToList();
                if (awardsIds.Any())
                {
                    foreach (var itemawardsId in awardsIds)
                    {
                        sb.Append(string.Format("{0} {1} \r\n", personItem.Name, AwardHelper.GetAwardById(itemawardsId).Title));
                    }
                }
                else
                {
                    sb.Append(string.Format("{0} Наград нет \r\n", personItem.Name));
                }
            }

            var fs = new MemoryStream(Encoding.UTF8.GetBytes(sb.ToString()));

            return(File(fs, "text/csv"));
        }
Esempio n. 2
0
        public ActionResult IndexByUser(string userName)
        {
            var res = PersonLinkAwardHelper.GetPersonLinkAwardList()
                      .Where(_ => _.PersonModelData.Name == userName)
                      .Select(_ => _.AwardModelData)
                      .ToList();

            return(View("Index", res));
        }
Esempio n. 3
0
        public ActionResult CheckAwardDuplicate(PersonLinkAwardModel personLinkAwardModel)
        {
            var currentList = PersonLinkAwardHelper.GetPersonLinkAwardList();

            if (currentList.Any(_ => _.AwardModelData.Id == personLinkAwardModel.AwardId && _.PersonModelData.Id == personLinkAwardModel.PersonId))
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
Esempio n. 4
0
 public ActionResult Index()
 {
     return(View(PersonLinkAwardHelper.GetPersonLinkAwardList()));
 }