示例#1
0
        public Result Add(ViewOrder order)
        {
            Order _order = ViewOrder.ToEntity(order);

            _order = _repository.Add(_order);
            return(new Result(0, "", ViewOrder.ToViewModel(_order)));
        }
示例#2
0
        public int updateEntity(ViewOrder vo)
        {
            //var entity = dbSet.Find(vo.ID);

            //if (entity != null)
            //{
            //    Context.Entry(entity).State = System.Data.EntityState.Detached;
            //    //这个是在同一个上下文能修改的关键
            //}

            //entity = model;

            //Update(entity);
            _repository.updateEntity(ViewOrder.ToEntity(vo));
            return(_repository.Save());
        }