Example #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"));
        }
Example #2
0
        public ActionResult IndexByUser(string userName)
        {
            var res = PersonLinkAwardHelper.GetPersonLinkAwardList()
                      .Where(_ => _.PersonModelData.Name == userName)
                      .Select(_ => _.AwardModelData)
                      .ToList();

            return(View("Index", res));
        }
Example #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));
        }
Example #4
0
        public ActionResult AttachedAward(PersonLinkAwardModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            PersonLinkAwardHelper.AddAwardToPerson(model);
            return(RedirectToAction("Index"));
        }
Example #5
0
 public ActionResult Delete(Guid personId, Guid awardId)
 {
     PersonLinkAwardHelper.DeeteAttachedAward(personId, awardId);
     return(RedirectToAction("Index"));
 }
Example #6
0
 public ActionResult NewAttachAward()
 {
     ViewBag.PersonModelListItem = PersonLinkAwardHelper.PersonModelListItem();
     ViewBag.AwardModelListItem  = PersonLinkAwardHelper.AwardModelListItem();
     return(View(PersonLinkAwardHelper.NewAttachAward()));
 }
Example #7
0
 public ActionResult Index()
 {
     return(View(PersonLinkAwardHelper.GetPersonLinkAwardList()));
 }