Example #1
0
        public IHttpActionResult EditAward(int id, [FromBody] EditAwardVM updatedAward)
        {
            var award = bllModel.GetAwardById(id);

            if (award == null)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                if (!string.IsNullOrWhiteSpace(updatedAward.Title))
                {
                    award.Title = updatedAward.Title;
                }

                if (!string.IsNullOrWhiteSpace(updatedAward.Title))
                {
                    award.Description = updatedAward.Description;
                }

                if (bllModel.UpdateAward(award))
                {
                    return(Ok());
                }
            }

            return(BadRequest("We can't edit award with this parametrs"));
        }
Example #2
0
        public ActionResult ShowModalForAward(int awardId)
        {
            if (Request.IsAjaxRequest())
            {
                var model = Mapper.Map <DisplayAwardVM>(awardModel.GetAwardById(awardId));

                return(PartialView("_AwardDescriptionModalPartial", model));
            }

            return(null);
        }
Example #3
0
        public ActionResult Edit(int id)
        {
            var award = bllModel.GetAwardById(id);

            if (award == null)
            {
                return(RedirectToAction("Index"));
            }

            var awardModel = Mapper.Map <EditAwardVM>(award);

            return(View(awardModel));
        }