コード例 #1
0
        public Customer Post(string type, Customer customer)
        {
            Customer newcustomer = new Customer();

            try
            {
                if (type == "ids")
                {
                    Customer cust = context.Customers.Where(x => x.Deleted == false).Where(x => x.Mobile == customer.Mobile).SingleOrDefault();
                    if (cust == null)
                    {
                        newcustomer = context.CustomerRegistration(customer);
                    }
                    else
                    {
                        if (customer.Mobile == cust.Mobile && customer.Password == cust.Password)
                        {
                            return(cust);
                        }
                        else if (customer.Mobile == cust.Mobile && customer.Password != cust.Password)
                        {
                            newcustomer.Mobile   = customer.Mobile;
                            newcustomer.Password = null;
                            return(newcustomer);
                        }
                    }
                }
            }
            catch
            {
                return(null);
            }
            return(newcustomer);
        }