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 }); } }
public void DeleteCustomerJSON(CustomerJSON customer) { var entity = DB.Customers.Where(c => c.CustomerID == customer.CustomerID).Single(); DB.Customers.Remove(entity); }
public void UpdateCustomerJSON(CustomerJSON customer) { //make update here }
public void InsertCustomerJSON(CustomerJSON customer) { //make insert here }
public void DeleteCustomerJSON(CustomerJSON customer) { Customer entity = DB.Customer.Where(c => c.CustomerId == customer.CustomerId).Single(); DB.Customer.Remove(entity); }