Ejemplo n.º 1
0
        public dynamic Put(int id, [FromBody] XmlModel value)
        {
            var domainId = User.GetDomainId();

            var item = _ctx.Avxml.Where(t => t.Id == id && t.Project.Domainid == domainId).SingleOrDefault();

            item.Name = value.Name;
            item.Data = CreateElement(value.Node).ToString();
            _ctx.SaveChanges();
            return(new { });
        }
Ejemplo n.º 2
0
        public dynamic Post([FromBody] XmlModel value)
        {
            var domainId = User.GetDomainId();

            if (!_ctx.Avproject.Where(t => t.Domainid == domainId).Any())
            {
                _ctx.Avproject.Add(new Avproject()
                {
                    Title = "-", Code = "-", Domainid = domainId
                });
                _ctx.SaveChanges();
            }
            var project = _ctx.Avproject.Where(t => t.Domainid == domainId).FirstOrDefault();

            _ctx.Avxml.Add(new Avxml()
            {
                Name = value.Name, Data = CreateElement(value.Node).ToString(), Project = project
            });
            _ctx.SaveChanges();
            return(new { });
        }