コード例 #1
0
        public CustomerModel Post(CustomerModel model)
        {
            var customer = new CustomerInfo();

            customer.Fill(model);
            customer.Save();

            return(customer.CastOrFill <CustomerModel>());
        }
コード例 #2
0
        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>());
        }
コード例 #3
0
        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>());
        }