Exemplo n.º 1
0
        public HttpResponseMessage NoEmailAddress()
        {
            var    dbCustomer     = InsuranceContext.UniqueCustomers.All(orderBy: "CreatedOn desc").FirstOrDefault();
            int    uniqueId       = 0;
            string customerUserId = "";

            if (dbCustomer != null)
            {
                uniqueId       = Convert.ToInt32(dbCustomer.UniqueCustomerId);
                uniqueId       = uniqueId + 1;
                customerUserId = "Guest-" + uniqueId + "@gmail.com";
                var uniquCustomer = new UniqueCustomer {
                    UniqueCustomerId = uniqueId, CreatedOn = DateTime.Now
                };
                InsuranceContext.UniqueCustomers.Insert(uniquCustomer);
            }
            else
            {
                uniqueId       = 1000;
                customerUserId = "Guest-" + uniqueId + "@gmail.com";
                var uniquCustomer = new UniqueCustomer {
                    UniqueCustomerId = uniqueId, CreatedOn = DateTime.Now
                };
                InsuranceContext.UniqueCustomers.Insert(uniquCustomer);
            }

            return(Request.CreateResponse(HttpStatusCode.OK, customerUserId));
        }
Exemplo n.º 2
0
        public CustomerModel GetCustomerUniquEmail()
        {
            CustomerModel model      = new CustomerModel();
            var           dbCustomer = InsuranceContext.UniqueCustomers.All(orderBy: "CreatedOn desc").FirstOrDefault();

            int    uniqueId       = 0;
            string customerUserId = "";

            if (dbCustomer != null)
            {
                uniqueId       = Convert.ToInt32(dbCustomer.UniqueCustomerId);
                uniqueId       = uniqueId + 1;
                customerUserId = "Guest-" + uniqueId + "@gmail.com";
                var uniquCustomer = new UniqueCustomer {
                    UniqueCustomerId = uniqueId, CreatedOn = DateTime.Now
                };
                InsuranceContext.UniqueCustomers.Insert(uniquCustomer);
            }
            else
            {
                uniqueId       = 1000;
                customerUserId = "Guest-" + uniqueId + "@gmail.com";
                var uniquCustomer = new UniqueCustomer {
                    UniqueCustomerId = uniqueId, CreatedOn = DateTime.Now
                };
                InsuranceContext.UniqueCustomers.Insert(uniquCustomer);
            }

            model.CustomEmail = customerUserId;
            return(model);
        }