Ejemplo n.º 1
0
        public HttpStatusCode CreateAttribute(CreateAttributeDto createAttributeDto)
        {
            AttributeGroup attributeGroup = _ctx.AttributeGroups
                                            .FirstOrDefault(f => f.Id == createAttributeDto.AttributeGroupId);

            var model = AttributeFactory.AttributeToDbo(createAttributeDto, attributeGroup);

            try
            {
                _ctx.Attributes.Add(model);
                _ctx.SaveChanges();

                return(HttpStatusCode.OK);
            }
            catch (Exception ex)
            {
                return(HttpStatusCode.InternalServerError);
            }
        }