public async Task <IActionResult> UpdateLevel(LevelDto leveldto)
        {
            if (ModelState.IsValid)
            {
                var updated = await _levelBusiness.UpdateLevel(leveldto);

                if (updated)
                {
                    return(Ok("updated successfully"));
                }
            }
            return(BadRequest(ModelState));
        }
Пример #2
0
 public async Task <IActionResult> AddOrUpdate(LevelDto levelDto)
 {
     if (levelDto.LevelId > 0)
     {
         await _levelBusiness.UpdateLevel(levelDto);
     }
     else
     {
         var levelParameter = new LevelParameter {
             LevelName = levelDto.LevelName
         };
         await _levelBusiness.AddLevel(levelParameter);
     }
     return(RedirectToAction("GetAllLevels"));
 }