public async Task <int> Create(SiteDTO site) { using (var db = _contextFactory.CreateDb()) { var newSite = _mapper.Map <Site>(site); db.Sites.Add(newSite); await db.SaveChangesAsync(); return(newSite.SiteID); } }
public ActionResult Create(SiteDTO client) { try { siteService.Create(client); NotificationsController.AddNotification(this.User.SafeUserName(), $"{client.SiteName} has been created."); return(RedirectToAction(nameof(Create))); } catch { return(View()); } }