Exemplo n.º 1
0
        public int Add(CharityEventInputModel inputModel)
        {
            var charityEvent = _mapper.Map <CharityEventInputModel, CharityEvent>(inputModel);

            charityEvent.CreatedDate = DateTime.Now;

            _context.CharityEvents.Add(charityEvent);

            _context.SaveChanges();

            return(charityEvent.Id);
        }
Exemplo n.º 2
0
        public IActionResult Add([FromBody] CharityEventInputModel inputModel)
        {
            if (ModelState.IsValid == false)
            {
                return(BadRequest());
            }

            int id = charityEventService.Add(inputModel);

            SendEmailEventWasAdded(id);

            return(Ok());
        }