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); }
public IActionResult Add([FromBody] CharityEventInputModel inputModel) { if (ModelState.IsValid == false) { return(BadRequest()); } int id = charityEventService.Add(inputModel); SendEmailEventWasAdded(id); return(Ok()); }