public IActionResult Put(int id, [FromBody] UnitTypeModel updatedUnitType)
        {
            var unitType = _unitTypeService.Update(updatedUnitType.ToDomainModel());

            if (unitType == null)
            {
                return(NotFound());
            }
            return(Ok(unitType.ToApiModel()));
        }
        public IHttpActionResult UpdateUnitType(UnitType s_UnitType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _UnitTypeService.Update(s_UnitType);

            return(CreatedAtRoute("DefaultApi", new { id = s_UnitType.UnitTypeID }, s_UnitType));
        }
Example #3
0
 public ActionResult Edit(UnitType unitType)
 {
     try
     {
         // TODO: Add update logic here
         _unitTypeService.Update(new UnitType
         {
             UnitTypeName = unitType.UnitTypeName,
             UnitTypeId   = unitType.UnitTypeId
         });
         SuccessNotification("Kayıt Güncellendi");
         return(RedirectToAction("UnitTypeIndex"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Edit(UnitType unitType)
 {
     try
     {
         _unitTypeService.Update(new  UnitType
         {
             //TODO:Alanlar buraya yazılacak Id alanı en altta olacak unutmayın!!!
             //Örn:BrandName = brand.BrandName,
             //BrandId = brand.BrandId
             UnitTypeId = unitType.UnitTypeId
         });
         SuccessNotification("Kayıt Güncellendi");
         return(RedirectToAction("UnitTypeIndex"));
     }
     catch
     {
         return(View());
     }
 }