public async Task <IActionResult> AddSellerActivity([FromBody] AppSellerActivity model) { if (ModelState.IsValid) { try { model.AppSellerActivityId = Guid.NewGuid(); var sellerActivity = await sellerRepository.AddSellerActivity(model); if (sellerActivity != null) { return(Ok(sellerActivity)); } else { return(NotFound()); } } catch (Exception excp) { return(BadRequest(excp)); } } return(BadRequest()); }
public async Task <AppSellerActivity> UpdateSellerActivity(AppSellerActivity activity) { if (db != null) { //Delete that post db.AppSellerActivity.Update(activity); //Commit the transaction await db.SaveChangesAsync(); } return(activity); }
public async Task <AppSellerActivity> AddSellerActivity(AppSellerActivity activity) { if (db != null) { activity.AppSellerActivityId = Guid.NewGuid(); activity.CreatedDate = DateTime.Now; await db.AppSellerActivity.AddAsync(activity); await db.SaveChangesAsync(); return(activity); } return(activity); }
public async Task <IActionResult> UpdateSellerActivity([FromBody] AppSellerActivity model) { if (ModelState.IsValid) { try { await sellerRepository.UpdateSellerActivity(model); return(Ok()); } catch (Exception excp) { if (excp.GetType().FullName == "Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException") { return(NotFound()); } return(BadRequest(excp)); } } return(BadRequest()); }