Exemplo n.º 1
0
 public ServiceEntity Update(ServiceEntity entity)
 {
     try
     {
         _serviceRepository.Update(entity);
         return entity;
     }
     catch (Exception e)
     {
         _log.Error(e, "数据库操作出错");
         return null;
     }
 }
Exemplo n.º 2
0
 public bool Delete(ServiceEntity entity)
 {
     try
     {
         _serviceRepository.Delete(entity);
         return true;
     }
     catch (Exception e)
     {
         _log.Error(e, "数据库操作出错");
         return false;
     }
 }
Exemplo n.º 3
0
 public HttpResponseMessage Post(ServiceModel model)
 {
     var entity=new ServiceEntity
     {
         Name = model.Name,
         Class = model.Class,
         AddTime = DateTime.Now,
         AddUser = _workContext.CurrentUser.Id,
         Link = model.Link,
         UpTime = DateTime.Now,
         UpUser = _workContext.CurrentUser.Id
     };
     if (_serviceService.Create(entity).Id > 0)
     {
         return PageHelper.toJson(PageHelper.ReturnValue(true, "数据添加成功"));
     }
     return PageHelper.toJson(PageHelper.ReturnValue(false, "数据添加失败"));
 }