Example #1
0
 public static SiteModel ConvertToSiteModel(this ClientSite x)
 {
     var model = new SiteModel
     {
         Id = x.Id,
         Name = x.Name,
         Company = x.Owner == null ? String.Empty : x.Owner.Name,
         PagesCount = x.Pages == null ? 0 : x.Pages.Count,
         //Domains = x.Domains == null ? String.Empty : x.Domains.Aggregate((a, b) => a + ";" + b),
         Url = x.Url,
         CompanyId = x.Owner == null ? Guid.Empty : x.Owner.Id,
     };
     if (x.Domains != null)
     {
         foreach (var domain in x.Domains)
         {
             model.Domains += domain + "; ";
         }
         model.Domains.Remove(model.Domains.Length - 1);
     }
     return model;
 }
Example #2
0
 public ActionResult Add(SiteModel model)
 {
     var dbSite = model.ConvertToDbSite();
     _siteBusinessLogic.Update(dbSite);
     return RedirectToAction("List");
 }