Ejemplo n.º 1
0
        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");
        }
Ejemplo n.º 2
0
 public IActionResult Cost()
 {
     if (Program.Worker == null)
     {
         return(Redirect("~/Home/Enter"));
     }
     return(View(APIWorker.GetRequest <List <CostViewModel> >($"api/main/getcosts?workerId={Program.Worker.Id}")));
 }
Ejemplo n.º 3
0
        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");
        }
Ejemplo n.º 4
0
        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");
        }
Ejemplo n.º 5
0
        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, пароль");
        }
Ejemplo n.º 6
0
        public decimal Bind(int request)
        {
            RequestViewModel Request = APIWorker.GetRequest <RequestViewModel>($"api/main/getrequestnl?Id={request}");

            return(Request.RequestCost);
        }
Ejemplo n.º 7
0
 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());
 }
Ejemplo n.º 8
0
 public IActionResult UpdateCost(int id)
 {
     ViewBag.Cost = APIWorker.GetRequest <CostViewModel>($"api/main/getcosts?costId={id}");
     return(View());
 }
Ejemplo n.º 9
0
 public IActionResult UpdateWork(int id)
 {
     ViewBag.Works = APIWorker.GetRequest <WorkerViewModel>($"api/main/getworks?workId={id}");
     return(View());
 }