public ActionResult Create(DomainCreateRequest model)
        {
            _domainService.Create(new Domain {
                SiteDomain = model.SiteDomain, DomainAlias = model.DomainAlias
            });

            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        //[HttpPost]
        //[ValidationFilter]
        public override HttpResponseMessage Create(User resource)
        {
            User lead = _userDomainService.Create(resource);

            if (string.IsNullOrWhiteSpace(resource.Id))
            {
                Error(HttpStatusCode.BadRequest, "Error while creating the Lead.");
            }

            return(Request.CreateResponse(HttpStatusCode.Created, lead));
        }
Beispiel #3
0
        public virtual HttpResponseMessage Create(T resource)
        {
            if (resource == null)
            {
                Error(HttpStatusCode.BadRequest, "Incorrect {0} details.");
            }

            T t = _domainService.Create(resource);

            if (resource == null)
            {
                Error(HttpStatusCode.BadRequest, "Error while creating {0}.");
            }

            return(Request.CreateResponse(HttpStatusCode.Created, t));
        }
        public override HttpResponseMessage Create(Country resource)
        {
            if (resource == null)
            {
                Error(HttpStatusCode.NoContent, "Country can't be null.");
            }

            Country country = _countryDomainService.Create(resource);

            if (string.IsNullOrWhiteSpace(resource.Code))
            {
                Error(HttpStatusCode.BadRequest, "Error while creating the County.");
            }

            return(Request.CreateResponse(HttpStatusCode.Created, country));
        }
        public override HttpResponseMessage Create(Lead resource)
        {
            if (resource == null)
            {
                Error(HttpStatusCode.NoContent, "Lead can't be null.");
            }

            Lead lead = _leadDomainService.Create(resource);

            if (string.IsNullOrWhiteSpace(resource.Id))
            {
                Error(HttpStatusCode.BadRequest, "Error while creating the Lead.");
            }

            return(Request.CreateResponse(HttpStatusCode.Created, lead));
        }
        public override HttpResponseMessage Create(Course resource)
        {
            if (resource == null)
            {
                Error(HttpStatusCode.BadRequest, "Incorrect course details.");
            }

            Course course = _courseDomainService.Create(resource);

            if (string.IsNullOrWhiteSpace(resource.Id))
            {
                Error(HttpStatusCode.BadRequest, "Error while creating Course.");
            }

            return(Request.CreateResponse(HttpStatusCode.Created, course));
        }
 public IActionResult Create(Domain domain)
 {
     if (ModelState.IsValid)
     {
         try
         {
             domain.TenantId = _authenticationService.TenantId;
             _domainService.Create(domain);
             return(RedirectToAction("search"));
         }
         catch (ValidationErrorException ex)
         {
             _validationService.RegisterValidationErrors(ModelState, ex.Errors, "Domain");
         }
     }
     return(Create());
 }