コード例 #1
0
 public async Task<string> InserirAsync(Material oMaterial)
 {
     try
     {
         return await Material.InserirAsync(oMaterial);
     }
     catch (Exception ex)
     {
         return ex.Message;
     }
 }
コード例 #2
0
 public async static Task<string> InserirAsync(Material oMaterial)
 {
     using (var oDB = new CAPEntities())
     {
         try
         {
             oDB.Material.Add(oMaterial);
             await oDB.SaveChangesAsync();
             return null;
         }
         catch (Exception ex)
         {
             return ex.ToString();
         }
     }
 }
コード例 #3
0
 public async static Task<string> AlterarAsync(Material oMaterial)
 {
     using (var oDB = new CAPEntities())
     {
         try
         {
             oDB.Material.Attach(oMaterial);
             oDB.Entry(oMaterial).State = EntityState.Modified;
             await oDB.SaveChangesAsync();
             return null;
         }
         catch (Exception ex)
         {
             return ex.ToString();
         }
     }
 }