public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } this.Check.Photo = await Uplode(photo, "Check"); check.AddCheck(Check); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAddAsync(uplodechkeck uplodechkeck) { int id = _incomes.AddCheck(new Check() { Amount = uplodechkeck.Amount, DueDate = DateTime.Parse(uplodechkeck.DueDate), Name = uplodechkeck.Name, Photo = await Uplode(uplodechkeck.files, "Check") }); var x = new cc() { Id = id, Amount = uplodechkeck.Amount, DueDate = uplodechkeck.DueDate, Name = uplodechkeck.Name, files = _incomes[id].Photo }; ModelState.Clear(); return(new JsonResult(x)); }
public async Task <IActionResult> OnPostAsync() { int customerID = await customer.AddCustomer(new Customer() { Adress = cars.CustomerAdress, IdPhoto = await Uplode(cars.CustomerIdPhoto, "Customers"), Name = cars.CustomerName, Phone = cars.CustomerPhone }); int incomeID = await income.AddIncome(new Income() { Price = cars.PriceIncome }); if (cars.CheckAmount.Count > 0) { for (int i = 0; i < cars.CheckAmount.Count; i++) { check.AddCheck(new Check() { Amount = cars.CheckAmount[i], DueDate = cars.DueDate[i], IncomeId = incomeID, Name = cars.CheckOwner[i], Photo = await Uplode(cars.CheckPhoto[i], "Check") }); } } await cash.AddCashAsync(new Cash() { Amount = cars.cashTaken, IncomeId = incomeID, Arrested = true }); int saleID = await _sale.Addsale(new Sale() { CarId = cars.carID, Commission = 0, CustomerId = customerID, Date = DateTime.Today, }); var x = car[cars.carID]; x.Sold = true; await car.UpdateCarAsync(x); await sellrecord.AddsellRecords(new SellRecords() { IncomeId = incomeID, SaleId = saleID }); callproc cc = new callproc(); cc.updateCapitalShare(this.User.FindFirst(ClaimTypes.NameIdentifier).Value); cc = null; return(RedirectToAction("Index", "Home")); }
public async Task <IActionResult> OnPostAsync() { { var car = new Car() { Id = 0, CarId = bUYACAR.CarID, Insurance = bUYACAR.Insurance.Value, ModelId = bUYACAR.ModelId, MoreDetails = bUYACAR.moreDetails, Owener = bUYACAR.CarOwener, }; var salePerson = new SalePerson() { Adress = bUYACAR.SaleAdress, Name = bUYACAR.SaleName, Phone = bUYACAR.SalePhone, Idnumber = bUYACAR.IDNumber, IdPhoto = await Uplode(bUYACAR.IdPhoto, "ID") }; var outcome = new Outcome() { Price = bUYACAR.PriceOutcome }; int OutcomeId = _outcome.AddOutcome(outcome).Result; var buy = new Buy() { Date = DateTime.Today, CarId = await _car.AddCar(car), CustomerId = await _saleperson.AddSalePerson(salePerson), }; var buyrecords = new BuyRecords() { BuyId = _buy.AddBuy(buy).Result, OutcomeId = OutcomeId, PartnerId = 1 }; await _buyrecord.AddBuyRecords(buyrecords); List <cc> dd = JsonConvert.DeserializeObject <List <cc> >(System.IO.File.ReadAllText("C:\\Users\\wwwmu\\source\\repos\\ManegmentSystems\\ManegmentSystems\\wwwroot\\data.json")); await _cash.AddCashAsync(new Cash() { Amount = bUYACAR.CashAmount[0], Arrested = true, OutcomeId = OutcomeId, IncomeId = null, DateArrested = DateTime.Today }); for (int i = 1; i < bUYACAR.CashAmount.Count - 1; i++) { await _cash.AddCashAsync(new Cash() { Amount = bUYACAR.CashAmount[i], Arrested = false, OutcomeId = OutcomeId, IncomeId = null }); } for (int i = 0; i < dd.Count; i++) { if (_check[dd[i].Id] == null) { _check.AddCheck(new Check() { Amount = dd[i].Amount, OutcomeId = OutcomeId, Name = dd[i].Name, DueDate = DateTime.Parse(dd[i].DueDate), IncomeId = null, Photo = dd[i].files }); } else { var m = _check[dd[i].Id]; m.OutcomeId = OutcomeId; await _check.UpdateCheck(dd[i].Id, m); } } } callproc cc = new callproc(); cc.updateCapitalShare(this.User.FindFirst(ClaimTypes.NameIdentifier).Value); cc = null; return(RedirectToPage("/gallary")); }