Пример #1
0
        public async Task <IHttpActionResult> PostDomain(DomainRequest item)
        {
            // Mapper.Reset();
            try
            {
                ValidationUtilities.ValidateDomain(item);
                string currentUserEmail = HttpUtilities.GetUserNameFromToken(this.Request);
                Mapper.Initialize(cfg => cfg.CreateMap <DomainRequest, Domain>().ForMember(i => i.CreatedBy,
                                                                                           j => j.UseValue(currentUserEmail)));
                var domain = Mapper.Map <DomainRequest, Domain>(item);
                domain.Id = Guid.NewGuid().ToString();
                Domain current = await InsertAsync(domain);

                return(CreatedAtRoute("Tables", new { id = current.Id }, current));
            }
            catch (HttpResponseException ex)
            {
                LGSELogger.Error(ex);
                throw ex;
            }
        }