Exemple #1
0
        public async Task <ActionResult <EntryBookDto> > Post([FromBody] EntryBookDto value)
        {
            var created = await _entryBookService.CreateEntry(value);

            if (created)
            {
                return(Ok(value));
            }
            return(BadRequest("Either Duplicate primary key or no person name"));;
        }
Exemple #2
0
        public async Task <bool> CreateEntry(EntryBookDto entryBookDto)
        {
            var obj = _dbContext.EntryBook.Where(x => x.PersonId == entryBookDto.PersonId).FirstOrDefault();

            if (obj == null && !(String.IsNullOrEmpty(entryBookDto.PersonName)))
            {
                await _dbContext.EntryBook.AddAsync(entryBookDto);

                int entryBook = await _dbContext.SaveChangesAsync();

                if (entryBook != 0)
                {
                    return(true);
                }
                return(false);
            }
            return(false);
        }
        public async Task <bool> CreateEntry(EntryBookDto entryBook)
        {
            var created = await _entryBookRepo.CreateEntry(entryBook);

            return(created);
        }