Exemple #1
0
        // GET: Units/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Unit unit = db.GetById(id);

            if (unit == null)
            {
                return(HttpNotFound());
            }
            return(View(unit));
        }
        // PUT api/<controller>/5
        /// <summary>
        /// Modifica un consorcio
        /// </summary>
        /// <param name="consortium">Consorcio a modificar</param>
        /// <returns></returns>
        public IHttpActionResult Put(int id, FunctionalUnitRequest unit)
        {
            var originalUnit = UnitService.GetById(id);
            var ret          = UnitService.UpdateUnit(originalUnit, unit);

            return(Ok());
        }
Exemple #3
0
 public ActionResult Add(int id)
 {
     if (id == 0)
     {
         return(View());
     }
     else
     {
         var unit = _unit.GetById(id);
         return(View(new UnitModel()
         {
             Id = unit.Id,
             Name = unit.Name
         }));
     }
 }
Exemple #4
0
 private void BindingData()
 {
     if (Id > 0)
     {
         var data = UnitService.GetById(Id);
         txtUnit.EditValue = data.Value;
     }
 }
        public IHttpActionResult Get(int id)
        {
            var completeUnit = UnitService.GetById(id);

            if (completeUnit == null)
            {
                throw new NotFoundException(ErrorMessages.UnidadNoEncontrada);
            }

            var dto = Mapper.Map <UnitResponse>(completeUnit);

            return(Ok(dto));
        }