public async Task <bool> AddAsync(TxnItemStock entity) { using (EkalContext dbContext = new EkalContext()) { try { await dbContext.TxnItemStock.AddAsync(entity); dbContext.SaveChanges(); return(true); } catch (Exception ex) { throw new Exception(ex.ToString()); } } }
protected async Task Save() { TxnItemStock entity = new TxnItemStock(); entity.ItemId = selectedItemID; entity.Qty = Qty; entity.Rate = Rate; entity.TotalAmount = Amount; entity.ItemProviderId = selectedProviderID; entity.Status = itemStatus; entity.EkaiId = selectedEkaiID; entity.CreatedDate = DateTime.Now; entity.CreatedBy = Common.UserProfileID; var response = await itemStockService.AddAsync(entity); if (response) { await LoadAsync(); ResetFields(); } }