public async Task <IActionResult> FilmsDel(int ID)
        {
            var username = User.Identity.Name;
            var user     = await _userManager.FindByNameAsync(username);

            var profile = await _profileService.GetProfileByUserId(user.Id);

            var Filmsdto = await _IApiService.GetInfoFilmsAsync(ID);

            var model = new Filmsdto
            {
                FilmsName = Filmsdto.title,
                FilmsId   = Filmsdto.id
            };

            await _filmsService.DeleteAsync(model, profile);

            return(RedirectToAction("FilmsInfo", "Films", new { id = ID }));
        }
Пример #2
0
        public async Task <IActionResult> DeleteAsync(int id)
        {
            if (id < 1)
            {
                return(BadRequest(new List <string> {
                    "Id can not be less than 1"
                }));
            }

            var entity = await _dataService.GetByIdOrDefaultAsync(id);

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

            var result = await _dataService.DeleteAsync(entity);

            return(result.ToActionResult());
        }