public void BindCost(int id, string costName, decimal costPrice, int request) { RequestViewModel Request = APIWorker.GetRequest <RequestViewModel>($"api/main/getrequestnl?Id={request}"); Dictionary <int, (string, decimal)> requestCost = Request.RequestCosts; if (requestCost.ContainsKey(Convert.ToInt32(id))) { requestCost[id] = (costName, costPrice); } else { requestCost.Add(id, (costName, costPrice)); } APIWorker.PostRequest("api/main/updaterequests", new RequestBindingModel { Id = Request.Id, ClientId = Request.ClientId, RequestName = Request.RequestName, RequestWorks = Request.RequestWorks, RequestCosts = Request.RequestCosts, }); Response.Redirect("../Cost"); }
public IActionResult Cost() { if (Program.Worker == null) { return(Redirect("~/Home/Enter")); } return(View(APIWorker.GetRequest <List <CostViewModel> >($"api/main/getcosts?workerId={Program.Worker.Id}"))); }
public void UpdateCost(int id, string costName, decimal costPrice) { var Cost = APIWorker.GetRequest <WorkerViewModel>($"api/main/getcosts?costId={id}"); APIWorker.PostRequest("api/main/createorupdatecost", new CostBindingModel { Id = id, WorkerId = Cost.WorkerId, CostName = costName, CostPrice = costPrice }); Response.Redirect("../Cost"); }
public void UpdateWork(int id, string workName, decimal workPrice) { var Work = APIWorker.GetRequest <WorkerViewModel>($"api/main/getworks?workId={id}"); APIWorker.PostRequest("api/main/updateworks", new WorkBindingModel { Id = id, WorkerId = Work.WorkerId, WorkName = workName, WorkPrice = workPrice }); Response.Redirect("../Index"); }
public void Enter(string email, string password) { if (!string.IsNullOrEmpty(email) && !string.IsNullOrEmpty(password)) { Program.Worker = APIWorker.GetRequest <WorkerViewModel>($"api/worker/login?email={email}&password={password}"); if (Program.Worker == null) { throw new Exception("Неверный email/пароль"); } Response.Redirect("Index"); return; } throw new Exception("Введите email, пароль"); }
public decimal Bind(int request) { RequestViewModel Request = APIWorker.GetRequest <RequestViewModel>($"api/main/getrequestnl?Id={request}"); return(Request.RequestCost); }
public IActionResult BindCost(int id) { ViewBag.Cost = APIWorker.GetRequest <WorkerViewModel>($"api/main/getcosts?costId={id}"); ViewBag.Request = APIWorker.GetRequest <List <RequestViewModel> >($"api/main/GetRequestList"); return(View()); }
public IActionResult UpdateCost(int id) { ViewBag.Cost = APIWorker.GetRequest <CostViewModel>($"api/main/getcosts?costId={id}"); return(View()); }
public IActionResult UpdateWork(int id) { ViewBag.Works = APIWorker.GetRequest <WorkerViewModel>($"api/main/getworks?workId={id}"); return(View()); }