public CustomerModel Post(CustomerModel model) { var customer = new CustomerInfo(); customer.Fill(model); customer.Save(); return(customer.CastOrFill <CustomerModel>()); }
public CustomerModel Get(string id) { var reader = ReadOnlyDatabase <CustomerInfo> .Construct(); var customer = new CustomerInfo(); if (id.IsInteger()) { customer = reader.GetByID(id.TryParseInt32()); } else { customer = reader.GetByKey(id.TryParseGuid()); } return(customer.CastOrFill <CustomerModel>()); }
public CustomerModel Delete(string id) { var reader = DatabaseReader <CustomerInfo> .Construct(); var customer = new CustomerInfo(); CustomerModel model = new CustomerModel(); if (id.IsInteger()) { customer = reader.GetByID(id.TryParseInt32()); } else { customer = reader.GetByKey(id.TryParseGuid()); } customer.Delete(); customer = reader.GetByID(id.TryParseInt32()); return(customer.CastOrFill <CustomerModel>()); }