Exemplo n.º 1
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Fund entity = _fundService.GetById(id.Value);

            if (entity == null)
            {
                return(HttpNotFound());
            }
            var viewmodel = Mapper.Map <Fund, FundEditViewModel>(entity);

            viewmodel.PrimaryFunds = _fundService.GetPrimaryFunds(entity.Year, entity.DbSource)
                                     .Select(t => new SelectListItem()
            {
                Text  = t.DisplayName + " - " + t.FundNumber,
                Value = t.Id.ToString()
            });
            return(View(viewmodel));
        }
 public IHttpActionResult GetPrimaryFunds(int year)
 {
     return(Ok(_fundService.GetPrimaryFunds(year, DbSource.ALL)));
 }