Esempio n. 1
0
        public static AttributeGroup AttributeGroupToDbo(CreateAttributeGroupDto createAttributeGroupDto)
        {
            var model = new AttributeGroup()
            {
                Name         = createAttributeGroupDto.AttributeGroupName,
                CreationDate = DateTime.Now
            };

            return(model);
        }
        public HttpStatusCode CreateAttributeGroup(CreateAttributeGroupDto createAttributeGroupDto)
        {
            AttributeGroup attributeGroup = AttributeGroupFactory.AttributeGroupToDbo(createAttributeGroupDto);

            try
            {
                _ctx.AttributeGroups.Add(attributeGroup);
                _ctx.SaveChanges();

                return(HttpStatusCode.OK);
            }
            catch (Exception ex)
            {
                return(HttpStatusCode.InternalServerError);
            }
        }
Esempio n. 3
0
        public HttpStatusCode CreateAttributeGroup(CreateAttributeGroupDto createAttributeGroupDto)
        {
            var response = _attributeGroupRepository.CreateAttributeGroup(createAttributeGroupDto);

            switch (response)
            {
            case HttpStatusCode.OK:
                return(HttpStatusCode.OK);

            case HttpStatusCode.InternalServerError:
                return(HttpStatusCode.InternalServerError);

            default:
                return(HttpStatusCode.NotFound);
            }
        }