Example #1
0
        public async Task <IActionResult> DeleteUserSkill(UserSkillToRemoveDto userSkilltoRemove)
        {
            if (userSkilltoRemove.UserId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            var userSkill = await _repo.GetUserSkill(userSkilltoRemove.UserId, userSkilltoRemove.SkillName);

            if (userSkill == null)
            {
                return(BadRequest());
            }

            _repo.Delete(userSkill);

            if (await _repo.SaveAll())
            {
                return(Ok());
            }
            else
            {
                return(BadRequest("Unable to remove the skill"));
            }
        }
        public ActionResult DeleteMission(int id)
        {
            var mission = _missionRepository.GetById(id);

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

            _missionRepository.Delete(mission);
            _missionRepository.SaveChanges();
            _notificationHub.Clients.All.SendAsync("SendMessage", "MissionDeleted");
            _notificationHub.Clients.All.SendAsync("Notification", "Миссия #" + mission.Id + " удалена.");
            return(NoContent());
        }
        public IActionResult Delete(int id)
        {
            var getMissionResponse = missionRepo.Get(id);

            if (!getMissionResponse.Success)
            {
                return(NotFound($"Mission {id} not found"));
            }

            var response = missionRepo.Delete(id);

            if (response.Success)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest(response.Message));
            }
        }
 public void Delete(MissionEntity entity)
 {
     missionRepository.Delete(entity.GetDalEntity());
     uow.Commit();
 }