예제 #1
0
        public Property Update(int typeId, string newValue, int attributeId)
        {
            try
            {
                var typeName = _context.Types.FirstOrDefault(x => x.Id == typeId).Name;
                typeName = typeName.ToLower();
                var sql = SqlOptions.GenerateUpdateScript(typeName, newValue, attributeId);
                _context.Database.ExecuteSqlCommand(sql);

                return(new SqlHandler(_context).GetTypePropertiesByName(typeName)
                       .FirstOrDefault(a => a.Id == attributeId));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }