public IActionResult TouchpointCreate(TouchpointCreateViewModel model) { if (!ModelState.IsValid) { return(View()); } var newTouchpoint = new Touchpoint { Date = model.Date, SortOfEvent = model.SortOfEvent, Description = model.Description, Reminder = model.Reminder, ContactId = model.ContactId, ApplicationUserId = model.ApplicationUserId, }; var response = _touchpointRepository.Add(newTouchpoint); if (response == null || response.Id == 0) { return(View()); } return(RedirectToAction("Index")); }
public Touchpoint Update(Touchpoint touchpoint) { var newTouchpoint = _context.Touchpoints.Update(touchpoint); if (newTouchpoint != null && newTouchpoint.State == EntityState.Modified) { var affectedRows = _context.SaveChanges(); if (affectedRows > 0) { return(newTouchpoint.Entity); } } return(null); }