public async Task <JsonResult> PutTimetable(Timetable timetable)
        {
            timetable.Timetable_Edited = DateTime.Now;
            var response = await _apiContext.PutRequest("Timetables/" + timetable.Timetable_Id, timetable);

            return(response);
        }
Пример #2
0
        public async Task <JsonResult> PutProduct(int product_id, string product_name, string product_net_price, decimal product_gross_price, int product_quantity, string product_icon, int product_status, List <int> category_id, List <int> club_id)
        {
            string result  = "";
            var    product = new Product()
            {
                Product_Id          = product_id,
                Category_Id         = category_id,
                Club_Id             = club_id,
                Product_Gross_Price = product_gross_price,
                Product_Icon        = product_icon,
                Product_Status      = product_status,
                Product_Name        = product_name,
                Product_Net_Price   = Math.Round(Convert.ToDecimal(product_net_price.Replace(".", ",")), 2),
                Product_Quantity    = product_quantity
            };

            try
            {
                JsonResult response = await _apiContext.PutRequest("Products/" + product.Product_Id, product);

                result = response.Value.ToString();
                // zastanowić się w jaki sposób czytać i przekazywać responsy!!!
            }
            catch (HttpRequestException e)
            {
                result = e.Message;
            }

            return(new JsonResult(result));
        }
Пример #3
0
        public async Task <JsonResult> PutService(int service_id, List <int> category_id, string service_name, string service_description, decimal service_gross_price, string service_net_price, List <int> service_employees_list, List <int> service_clubs_list, string mon_from, string mon_to, string tue_from, string tue_to, string wen_from, string wen_to, string thu_from, string thu_to, string fri_from, string fri_to, string sat_from, string sat_to, string sun_from, string sun_to, int service_duration)
        {
            string result = "";

            var service = new Service()
            {
                Service_Id            = service_id,
                Club_Id               = service_clubs_list,
                Employee_Id           = service_employees_list,
                Service_Description   = service_description,
                Service_Gross_Price   = service_gross_price,
                Service_Net_Price     = Math.Round(Convert.ToDecimal(service_net_price.Replace(".", ",")), 2),
                Service_Name          = service_name,
                Category_Id           = category_id,
                Service_Timelimit_Mon = new List <TimeSpan>()
                {
                    TimeSpan.Parse(mon_from + ":00"), TimeSpan.Parse(mon_to + ":00")
                },
                Service_Timelimit_Tue = new List <TimeSpan>()
                {
                    TimeSpan.Parse(tue_from + ":00"), TimeSpan.Parse(tue_to + ":00")
                },
                Service_Timelimit_Wed = new List <TimeSpan>()
                {
                    TimeSpan.Parse(wen_from + ":00"), TimeSpan.Parse(wen_to + ":00")
                },
                Service_Timelimit_Thu = new List <TimeSpan>()
                {
                    TimeSpan.Parse(thu_from + ":00"), TimeSpan.Parse(thu_to + ":00")
                },
                Service_Timelimit_Fri = new List <TimeSpan>()
                {
                    TimeSpan.Parse(fri_from + ":00"), TimeSpan.Parse(fri_to + ":00")
                },
                Service_Timelimit_Sat = new List <TimeSpan>()
                {
                    TimeSpan.Parse(sat_from + ":00"), TimeSpan.Parse(sat_to + ":00")
                },
                Service_Timelimit_Sun = new List <TimeSpan>()
                {
                    TimeSpan.Parse(sun_from + ":00"), TimeSpan.Parse(sun_to + ":00")
                },
                Service_Duration = service_duration
            };

            try
            {
                JsonResult response = await _apiContext.PutRequest("Services/" + service.Service_Id, service);

                result = response.Value.ToString();
                // zastanowić się w jaki sposób czytać i przekazywać responsy!!!
            }
            catch (HttpRequestException e)
            {
                result = e.Message;
            }

            return(new JsonResult(result));
        }
Пример #4
0
        public async Task <JsonResult> UpdateAsync(Activity activity)
        {
            JsonResult response = await _apiContext.PutRequest("Activities/" + activity.Activity_Id + "/", activity);

            if (response.Value.ToString() == "400")
            {
                Response.StatusCode = 400;
                return(new JsonResult("Nie udało się wgrać danych aktywności. Zweryfikuj poprawność danych."));
            }
            else
            {
                return(response);
            }
        }
Пример #5
0
        public async Task <JsonResult> UpdateCategory(Category category)
        {
            var res = await _apiContext.PutRequest("Categories/" + category.Category_Id, category);

            if (res.Value.ToString() == "400")
            {
                Response.StatusCode = 400;
                return(new JsonResult("Wystąpił błąd podczas zapisywania kategorii"));
            }
            else
            {
                return(res);
            }
        }
Пример #6
0
        public async Task <JsonResult> Update(Customer customer)
        {
            var addedStatus = await _apiContext.PutRequest("Customers/" + customer.Customer_Id, customer);

            if (addedStatus.Value == "400")
            {
                Response.StatusCode = 404;
                return(new JsonResult("ERR"));
            }
            else
            {
                Response.StatusCode = 200;
                return(addedStatus);
            }
        }
Пример #7
0
        public async Task <JsonResult> Update(Employee employee)
        {
            var addedStatus = await _apiContext.PutRequest("Employees/" + employee.Employee_Id, employee);

            if (addedStatus.Value == "400")
            {
                Response.StatusCode = 404;
                return(new JsonResult("ERR"));
            }
            else
            {
                Response.StatusCode = 200;
                return(addedStatus);
            }
        }
Пример #8
0
        public async Task <JsonResult> UpdateVoucher(Voucher voucher)
        {
            var res = await _apiContext.PutRequest("Vouchers/" + voucher.Voucher_Id + "/", voucher);

            return(res);
        }