Пример #1
0
        public ActionResult GetByName(string name)
        {
            InfoAwardModel award = Mapper.Map <InfoAwardModel>(ProviderLogic.AwardLogic.GetByName(name));

            if (award != null)
            {
                ViewBag.Awards = ProviderLogic.AwardLogic.GetByIdUser(award.ID);
            }
            return(View("InfoAward", award));
        }
Пример #2
0
 public ActionResult EditAward(InfoAwardModel updateAward, HttpPostedFileBase image)
 {
     if (ModelState.IsValid)
     {
         Award award = Mapper.Map <Award>(updateAward);
         if (image != null)
         {
             Image newImage = new Image();
             newImage.Type = image.ContentType;
             newImage.Name = image.FileName;
             newImage.Byte = new byte[image.ContentLength];
             image.InputStream.Read(newImage.Byte, 0, image.ContentLength);
             ProviderLogic.AwardLogic.UpdateImage(award.ID, newImage);
         }
         ProviderLogic.AwardLogic.Update(award);
         return(RedirectToAction("InfoAward", "Awards", new { id = updateAward.ID }));
     }
     return(View(updateAward));
 }
Пример #3
0
        public ActionResult SearchByName(string name)
        {
            IEnumerable <InfoAwardModel> awards;
            InfoAwardModel award = Mapper.Map <InfoAwardModel>(ProviderLogic.AwardLogic.GetByName(name));

            if (award != null)
            {
                return(View("InfoAward", award));
            }
            if (name.Count() == 1)
            {
                awards = Mapper.Map <IEnumerable <InfoAwardModel> >(ProviderLogic.AwardLogic.GetByLetterName(name));
                if (awards != null)
                {
                    return(View("Index", awards));
                }
            }
            awards = Mapper.Map <IEnumerable <InfoAwardModel> >(ProviderLogic.AwardLogic.GetByPartName(name));
            if (awards != null)
            {
                return(View("Index", awards));
            }
            return(RedirectToAction("Index"));
        }