コード例 #1
0
 public async Task<IHttpActionResult> PostProduct(TradeShows TradeShows)
 {
     if (ModelState.IsValid)
     {
         await Repository.SaveTradshowAsync(TradeShows);
         return Ok();
     }
     else
     {
         return BadRequest(ModelState);
     }
 }
コード例 #2
0
 public async Task<int> SaveTradshowAsync(TradeShows TradeShows)
 {
     if (TradeShows.Id == 0)
     {
         context.TradeShows.Add(TradeShows);
     }
     else
     {
         TradeShows dbEntry = context.TradeShows.Find(TradeShows.Id);
         if (dbEntry != null)
         {
             dbEntry.TradeShowName = TradeShows.TradeShowName;
             dbEntry.LeadName = TradeShows.LeadName;
             dbEntry.EmailAddress = TradeShows.EmailAddress;
             dbEntry.Telepohone = TradeShows.Telepohone;
           
         }
     }
     return await context.SaveChangesAsync();
 }
コード例 #3
0
 public async Task<ActionResult> SaveTradeShow(TradeShows TradeShow)
 {
     await repo.SaveTradshowAsync(TradeShow);
     return RedirectToAction("Index");
 }