From b1707c9e95274c58691226fd8076c162e01b26f1 Mon Sep 17 00:00:00 2001 From: Jeremy Mill Date: Tue, 3 Nov 2015 12:39:43 -0500 Subject: [PATCH] added an API stub, changed customer data model, added angular holder service --- .../Controllers/NewCustomerController.cs | 21 +++++++++ .../TeamDBAwesome/Models/Customer.cs | 31 ++++++------- .../TeamDBAwesome/Scripts/_references.js | Bin 478 -> 576 bytes .../TeamDBAwesome/js/HolderService.js | 30 +++++++++++++ api_outline.txt | 41 ++++++++++++++++++ 5 files changed, 108 insertions(+), 15 deletions(-) create mode 100644 TeamDBAwesome/TeamDBAwesome/Controllers/NewCustomerController.cs create mode 100644 TeamDBAwesome/TeamDBAwesome/js/HolderService.js create mode 100644 api_outline.txt diff --git a/TeamDBAwesome/TeamDBAwesome/Controllers/NewCustomerController.cs b/TeamDBAwesome/TeamDBAwesome/Controllers/NewCustomerController.cs new file mode 100644 index 0000000..61ac7a0 --- /dev/null +++ b/TeamDBAwesome/TeamDBAwesome/Controllers/NewCustomerController.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using TeamDBAwesome.Models; + +namespace TeamDBAwesome.Controllers +{ + public class NewCustomerController : ApiController + { + // GET api/NewCustomer/a JSON object rep of a customer + public HttpResponseMessage Get(Customer customer) + { + HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); + return response; + } + + } +} \ No newline at end of file diff --git a/TeamDBAwesome/TeamDBAwesome/Models/Customer.cs b/TeamDBAwesome/TeamDBAwesome/Models/Customer.cs index 0158244..d8d5f3a 100644 --- a/TeamDBAwesome/TeamDBAwesome/Models/Customer.cs +++ b/TeamDBAwesome/TeamDBAwesome/Models/Customer.cs @@ -10,51 +10,52 @@ public class Customer { //alpha upper and lowercase, spaces, dots and dashes from 2 to 20 chars [RegularExpression(@"^([A-Za-z\s\.-]{2,20})$")] - public string FName; + public string FName { get; set; } //alpha upper and lowercase, spaces, dots and dashes from 2 to 20 chars [RegularExpression(@"^([A-Za-z\s\.-]{2,20})$")] - public string LName; + public string LName { get; set; } //alpha upper and lowercase, spaces, dots, dashes, numbers, colons, pounds and commas from 2 to 70 chars [RegularExpression(@"^([A-z\s\-\d\.\#\:\,]{2,70})$")] - public string Address; + public string Address { get; set; } //alpha upper and lowercase, spaces, dots and dashes from 2 to 40 chars [RegularExpression(@"^([A-Za-z\s\.-]{2,40})$")] - public string City; + public string City { get; set; } //alpha upper and lowercase, spaces, dots and dashes from 2 to 40 chars [RegularExpression(@"^([A-Za-z\s\.-]{2,40})$")] - public string State; + public string State { get; set; } //5-15 digit long numbers [RegularExpression(@"^(\d{5,15})$")] - public string Post; + public string Post { get; set; } //alpha upper and lowercase, spaces, dots and dashes from 2 to 40 chars [RegularExpression(@"^([A-Za-z\s\.-]{2,40})$")] - public string Country; + public string Country { get; set; } //match a 10-15 digit long number [RegularExpression(@"^(\d{10,15})$")] - public string Phone; + public string Phone { get; set; } //match a 10-15 digit long number [RegularExpression(@"^(\d{10,15})$")] - public string Fax; + public string Fax { get; set; } //an Email Address [EmailAddress] - public string Email; + public string Email { get; set; } //alpha upper and lowercase, spaces, dots and dashes from 2 to 80 chars - [RegularExpression(@"^([A-Za-z\s\.-]{2,80})$")] - public string Company; + //right now I'm going to leave company blank because it's optional + //[RegularExpression(@"^([A-Za-z\s\.-]{2,80})$")] + public string Company { get; set; } //both of these are just ints - public int SupportRepId; - public int PersonID; - public int CustomerID; + public int SupportRepId { get; set; } + public int PersonID { get; set; } + public int CustomerID { get; set; } } } \ No newline at end of file diff --git a/TeamDBAwesome/TeamDBAwesome/Scripts/_references.js b/TeamDBAwesome/TeamDBAwesome/Scripts/_references.js index ddc626fcb4c286440f415381e06bc30b9f4d5822..cd13b935fb12bc7ece9478777e69e5f0df62b2d0 100644 GIT binary patch delta 51 zcmcb|e1K&_o~j;$9)mtZ7DF+R%wWi8$YDrfNM$Gj@K B4E_KB delta 10 RcmX@Wa*ugJ-o^_Bi~t%=1eO2* diff --git a/TeamDBAwesome/TeamDBAwesome/js/HolderService.js b/TeamDBAwesome/TeamDBAwesome/js/HolderService.js new file mode 100644 index 0000000..183bce0 --- /dev/null +++ b/TeamDBAwesome/TeamDBAwesome/js/HolderService.js @@ -0,0 +1,30 @@ +app.service('HolderService', function () { + + //declare the type + //don't change this without also changing the data model + var Blank_Customer = { + FName: null, + LName: null, + Address: null, + City: null, + State: null, + Post: null, + Country: null, + Phone: null, + Fax: null, + Email: null, + Company: null, + SupportRepID: null, + PersonID: null, + CustomerID: null + }; + + + //create the accessor for it + return { + getBlankCustomer: function () { + return Blank_Customer; + } + }; + +}); \ No newline at end of file diff --git a/api_outline.txt b/api_outline.txt new file mode 100644 index 0000000..5ecf4e5 --- /dev/null +++ b/api_outline.txt @@ -0,0 +1,41 @@ +Customer: + -Create account + -NEED: first and Last name, addr, city, state, country, postal, phone, fax, email + -OPT: company name + -edit account + -Search By: + -track name + -album name + -artist name + -composer name + -genre name + -media name + -OR, combination of all + -playlist: + -create playlist + -add track + -remove track + -create order + -playlists (either type) + -get order + -playlists (either type) + + +Employee: + -New media + -track name, album name, artist name, composer name, genre name, milliseconds, bytes, media type + -modify protected playlists + -add tracks + -remove tracks + -create new protected playlist + -View Customer Data: + -their demographics + -their playlists + -Orders: + -view pending orders + -approve or deny + + + + +