public IHttpActionResult PostSite(Site site)
        {
            if (site == null)
            {
                return(BadRequest("The site object can't be found in the request body."));
            }

            try
            {
                site.CreatedDate = DateTime.Now;
                sitesService.CreateSite(site);
                var sites = sitesService.GetSites();
                var html  = Helpers.RenderPartial("~/Views/Shared/Partial/Sites/SitesList.cshtml", sites);
                return(Ok(html));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
示例#2
0
 public async Task <ActionResult <SiteDto> > CreateSite(SiteDto pSiteDto)
 {
     _sitesService.CreateSite(pSiteDto);
     return(Ok());
 }