public async Task <bool> Update(ContentBaseModel updateModel, int operatingUserId)
        {
            //No need to check for duplicate as in some cases same content can be displayed twice.
            //So for now lets allow duplicate content

            ContentTbl tblRow = await _context.ContentTbl
                                .Where(row =>
                                       row.ContentId == updateModel.ContentId &&
                                       !row.IsDeleted)
                                .SingleOrDefaultAsync();

            //if no record found then show error
            if (tblRow == null)
            {
                throw new NotFoundException(ContentValidationMessage.CONTENT_NOT_FOUND);
            }

            //populate table objects
            _mapper.Map(updateModel, tblRow);

            tblRow.ModifiedBy   = operatingUserId;
            tblRow.ModifiedDate = DateTime.Now;

            await _context.SaveChangesAsync();

            return(true);
        }
        public async Task <bool> Create(ContentBaseModel createModel, int operatingUserId)
        {
            //No need to check for duplicate as in some cases same content can be displayed twice.
            //So for now lets allow duplicate content

            ContentTbl tblRow = new ContentTbl();

            //populate table object
            _mapper.Map(createModel, tblRow);

            tblRow.CreatedBy  = operatingUserId;
            tblRow.ModifiedBy = operatingUserId;

            await _context.AddAsync(tblRow);

            await _context.SaveChangesAsync();

            return(true);
        }
 public async Task <ActionResult <bool> > Create([FromBody] ContentBaseModel createModel)
 {
     return(await _contentService.Create(createModel, _operatingUser.GetUserId(HttpContext)));
 }