Exemple #1
0
        public async Task <ActionResult> DeleteComics(ComicsDTO comicsDTO)
        {
            var cs = await _comicsManager.Get();

            var comics = cs.Where(x => x.Id == comicsDTO.Id).FirstOrDefault();
            await _comicsManager.Delete(comics);

            return(Ok());
        }
Exemple #2
0
 public async Task Update(ComicsDTO comicsDTO)
 {
     try
     {
         Comics comics = _mapper.Map <ComicsDTO, Comics>(comicsDTO);
         _comicsRepository.Update(comics);
         await _comicsRepository.Save();
     }
     catch (Exception ex)
     {
         _loger.LogError(ex.Message);
     }
 }
Exemple #3
0
        public async Task Delete(ComicsDTO comicsDTO)
        {
            try
            {
                Comics com = await _comicsRepository.Get(comicsDTO.Id);

                _comicsRepository.Delete(com);
                await _comicsRepository.Save();
            }
            catch (Exception ex)
            {
                _loger.LogError(ex.Message);
            }
        }
Exemple #4
0
        public async Task Insert(ComicsDTO comicsDTO)
        {
            try
            {
                Comics comics = _mapper.Map <ComicsDTO, Comics>(comicsDTO);
                comics.DateCreated  = DateTime.Now;
                comics.DateModified = DateTime.Now;
                await _comicsRepository.Insert(comics);

                await _comicsRepository.Save();
            }
            catch (Exception ex)
            {
                _loger.LogError(ex.Message);
            }
        }
Exemple #5
0
        //[Authorize(Roles = "ComicsSeller")]
        public async Task <ActionResult> UpdateComics(ComicsDTO comicsDTO)
        {
            await _comicsManager.Update(comicsDTO);

            return(Ok());
        }
Exemple #6
0
        //[Authorize(Roles ="ComicsSeller")]
        public async Task <ActionResult> CreateComics(ComicsDTO comicsDTO)
        {
            await _comicsManager.Insert(comicsDTO);

            return(Ok());
        }