Exemple #1
0
        public async Task <EResponseBase <Customer_Response> > Add(Customer_Request model)
        {
            var request = JsonConvert.SerializeObject(model);
            var content = new StringContent(request, Encoding.UTF8, "application/json");

            var client = new HttpClient();

            client.BaseAddress = new Uri(_urlBase);
            var url = string.Concat(_endPoint);

            var response = client.PostAsync(url, content).Result;

            if (response.StatusCode == HttpStatusCode.OK)
            {
                var result = await response.Content.ReadAsStringAsync();

                return(JsonConvert.DeserializeObject <EResponseBase <Customer_Response> >(result));
            }

            return(new EResponseBase <Customer_Response>
            {
                IsSuccess = false,
                Code = (int)response.StatusCode,
                Message = "Error"
            });
        }
 public ActionResult Add(Customer_Request customer)
 {
     if (customer.CustomerID == 0)
     {
         var response = Task.Run(() => proxy.Add(customer));
         return(Json(response, JsonRequestBehavior.AllowGet));
     }
     else
     {
         var response = Task.Run(() => proxy.Update(customer));
         return(Json(response, JsonRequestBehavior.AllowGet));
     }
 }
Exemple #3
0
        public ActionResult makenewRequest(int planID, String firstname, String lastname, String email, String businessname, String BussinessAddress, String website, String role, String description, String dates)
        {
            System.Diagnostics.Debug.WriteLine("em ay day " + dates);
            SSMEntities       se   = new SSMEntities();
            productMarketPlan plan = se.productMarketPlans.Find(planID);
            contact           con  = new contact();

            con.FirstName   = firstname;
            con.MiddleName  = " ";
            con.Phone       = "Not available";
            con.Photo       = "Not available";
            con.DateOfBirth = DateTime.Today;
            con.Street      = BussinessAddress;
            con.LastName    = lastname;
            con.emails      = email;
            con.Comment     = description;
            company com = new company();

            com.companyName = businessname;
            com.Street      = BussinessAddress;
            com.logo        = "Not available";
            com.sites       = website;
            se.companies.Add(com);
            se.SaveChanges();
            con.CompanyID = com.id;
            se.contacts.Add(con);
            se.SaveChanges();
            Customer_Request request = new Customer_Request();

            request.RequestNo      = con.id + "" + com.id + "";
            request.PlanID         = planID;
            request.ProductID      = plan.softwareProduct.id;
            request.CusID          = con.id;
            request.CreatedDate    = DateTime.Today;
            request.RequestDemoDay = dates;
            se.Customer_Request.Add(request);
            se.SaveChanges();
            Notification noti = new Notification();

            noti.NotiName    = "New Request";
            noti.NotiContent = con.FirstName + " " + "has new request for " + plan.softwareProduct.name;
            noti.userID      = "3d23016d-074f-474e-a6b7-225de90b0cae";
            noti.CreateDate  = DateTime.Now;
            noti.viewed      = false;
            noti.hreflink    = "/Request/";
            se.Notifications.Add(noti);
            se.SaveChanges();
            return(View("Success"));
        }