コード例 #1
0
        public JSONResult <string> AddCustomer(CustomerJSON customer)
        {
            try
            {
                var reqCustomer = AuthoriseRequest();

                if (reqCustomer.AdminID != Customer.TOPLEVEL_ADMIN_ID)
                {
                    return(new JSONResult <string>()
                    {
                        Success = false, Error = "Sorry you are not authorised to add new customers."
                    });
                }
                else
                {
                    m_service.InsertCustomer(customer.ToCustomer());
                    var cust = m_service.GetCustomer(customer.Username);
                    return(new JSONResult <string>()
                    {
                        Success = true, Result = cust.ID
                    });
                }
            }
            catch (Exception excp)
            {
                return(new JSONResult <string>()
                {
                    Success = false, Error = excp.Message
                });
            }
        }
コード例 #2
0
        public void DeleteCustomerJSON(CustomerJSON customer)
        {
            var entity = DB.Customers.Where(c => c.CustomerID == customer.CustomerID).Single();

            DB.Customers.Remove(entity);
        }
コード例 #3
0
 public void UpdateCustomerJSON(CustomerJSON customer)
 {
     //make update here
 }
コード例 #4
0
 public void InsertCustomerJSON(CustomerJSON customer)
 {
     //make insert here
 }
コード例 #5
0
        public void DeleteCustomerJSON(CustomerJSON customer)
        {
            Customer entity = DB.Customer.Where(c => c.CustomerId == customer.CustomerId).Single();

            DB.Customer.Remove(entity);
        }