public override async Task <SeriesMessageResponse> DeleteActorSeries(ActorSeries request, ServerCallContext context)
        {
            try
            {
                var actor    = _mapper.Map <ActorSeries, Actor>(request);
                var response = await _actorRepository.DeleteActor(actor);

                if (!response)
                {
                    throw new Exception("SeriesRep - DeleteActorSeries");
                }
                return(new SeriesMessageResponse()
                {
                    Poruka = "Uspesno", Signal = true
                });
            }
            catch (Exception e)
            {
                _logger.LogError(e, "ERROR");
                return(new SeriesMessageResponse()
                {
                    Poruka = "Neuspesno", Signal = false
                });
            }
        }
        public async Task <IActionResult> DeleteActor(string id)
        {
            try
            {
                if (!Guid.TryParse(id, out Guid actorId))
                {
                    throw new GuidException("Invalid id", this.GetType().Name, "DeleteActor", "400");
                }

                await _actorRepository.DeleteActor(id);

                return(NoContent());
            }
            catch (MovieMindException e)
            {
                if (e.MovieMindError.Status.Equals("404"))
                {
                    return(NotFound(e.MovieMindError));
                }
                else
                {
                    return(BadRequest(e.MovieMindError));
                }
            }
        }
        //[ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(int id)
        {
            Actor actor = _actorRepository.GetActorById(id);

            _actorRepository.DeleteActor(actor.Id);
            _actorRepository.Save();

            return(RedirectToAction("Index"));
        }
示例#4
0
        public async Task <ActionResult <ActorDTO> > DeleteActor(int id)
        {
            if (id <= 0)
            {
                return(BadRequest());
            }
            await _actorRepository.DeleteActor(id);

            return(NoContent());
        }
示例#5
0
        public async Task <ActionResult <ActorDTO> > DeleteActor(int id)
        {
            var actorResult = await _actorRepository.DeleteActor(id).ConfigureAwait(false);

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

            return(actorResult);
        }
        public ActionResult Delete(int actorID)
        {
            Actor deletedActor = repository.DeleteActor(actorID);

            if (deletedActor != null)
            {
                TempData["message"] = string.Format("{0} was deleted",
                                                    deletedActor.Name);
            }
            return(RedirectToAction("Index"));
        }
 //[Authorize(Roles = Authorize.Admin)]
 public IActionResult Delete(int id)
 {
     try
     {
         var isDeleted = actorRepository.DeleteActor(id);
         return(Ok(isDeleted));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
示例#8
0
 public ActionResult DeleteConfirmed(int id)
 {
     try
     {
         _ActorRep.DeleteActor(id);
         _ActorRep.save();
         return(RedirectToAction("Index"));
     }
     catch (DataException)
     {
         return(RedirectToAction("Delete",
                                 new System.Web.Routing.RouteValueDictionary {
             { "id", id },
             { "saveChangesError", true }
         }));
     }
 }
示例#9
0
 public void Delete(int actorId)
 {
     _actorRepository.DeleteActor(actorId);
 }