Exemplo n.º 1
0
 public BaseResponse <bool> Create(CommonResourceCreateModel model)
 {
     try
     {
         if (model != null && !string.IsNullOrEmpty(model.ResourceKey) && !string.IsNullOrEmpty(model.ResourceValue))
         {
             var entity = new CommonResources();
             entity.InjectFrom(model);
             _commonContext.CommonResources.Add(entity);
             _commonContext.SaveChanges();
             return(BaseResponse <bool> .Success(true));
         }
         return(BaseResponse <bool> .BadRequest());
     }
     catch (Exception ex)
     {
         return(BaseResponse <bool> .InternalServerError(ex));
     }
 }