Example #1
0
        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);
            }
        }
Example #2
0
 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());
     }
 }