diff --git a/azuredeploy.json b/azuredeploy.json index fe1d43c..4afe820 100644 --- a/azuredeploy.json +++ b/azuredeploy.json @@ -38,7 +38,8 @@ "defaultValue": "master" }, "sqlServerName": { - "type": "string" + "type": "string", + "defaultValue": "todo-db" }, "sqlServerLocation": { "type": "string" diff --git a/src/MultiChannelToDo.Web/MultiChannelToDo.Web.csproj b/src/MultiChannelToDo.Web/MultiChannelToDo.Web.csproj index 3bf8b56..d1e0270 100644 --- a/src/MultiChannelToDo.Web/MultiChannelToDo.Web.csproj +++ b/src/MultiChannelToDo.Web/MultiChannelToDo.Web.csproj @@ -73,8 +73,6 @@ - - diff --git a/src/MultiChannelToDo.Web/app/js/services/ToDoService.js b/src/MultiChannelToDo.Web/app/js/services/ToDoService.js index f06ec54..4f3a45c 100644 --- a/src/MultiChannelToDo.Web/app/js/services/ToDoService.js +++ b/src/MultiChannelToDo.Web/app/js/services/ToDoService.js @@ -1,19 +1,18 @@ 'use strict'; -var apiPath = "https://donnam-multichannel.azurewebsites.net"; multiChannelToDoApp .factory('toDoService', ['$http', function ($http) { return { getItems: function () { - return $http.get(apiPath + '/api/ToDoItems'); + return $http.get(apiPath + '/ToDoItems'); }, add: function (id, task) { - return $http.post(apiPath + '/api/ToDoItems', { "Id": id + 1, "Text": task, "Complete": false }); + return $http.post(apiPath + '/ToDoItems', { "Id": id + 1, "Text": task, "Complete": false }); }, complete: function (item) { - return $http.put(apiPath + '/api/ToDoItems/' + item.Id, { "Id": item.Id, "Text": item.Text, "Complete": true }); + return $http.put(apiPath + '/ToDoItems/' + item.Id, { "Id": item.Id, "Text": item.Text, "Complete": true }); } } }]); \ No newline at end of file diff --git a/src/MultiChannelToDo.Web/bower.json b/src/MultiChannelToDo.Web/bower.json deleted file mode 100644 index 47ee379..0000000 --- a/src/MultiChannelToDo.Web/bower.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "MultiChannelToDo", - "version": "1.0.0.0", - "dependencies": { - "angular": "^1.3.6", - "jquery": "^2.1.3", - "bootstrap": "^3.3.2", - "normalize.css": "*" - } -} diff --git a/src/MultiChannelToDo.Web/package.json b/src/MultiChannelToDo.Web/package.json deleted file mode 100644 index 8a86550..0000000 --- a/src/MultiChannelToDo.Web/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "package-name", - "version": "0.3.0", - "author": "Author Name ", - "description": "Web front-end for MultiChannelToDo", - "devDependencies": { - "bower": "*", - "grunt": "*", - "grunt-bower-task": "*" - }, - "license": "MIT", - "engines": { - "node": ">=0.6" - } -} \ No newline at end of file diff --git a/src/MultiChannelToDo/App_Start/WebApiConfig.cs b/src/MultiChannelToDo/App_Start/WebApiConfig.cs index 7f540af..5a432ab 100644 --- a/src/MultiChannelToDo/App_Start/WebApiConfig.cs +++ b/src/MultiChannelToDo/App_Start/WebApiConfig.cs @@ -1,5 +1,6 @@ using System.Web.Http; using System.Web.Http.Cors; +using System.Configuration; namespace MultiChannelToDo { @@ -15,7 +16,10 @@ public static void Register(HttpConfiguration config) new { id = RouteParameter.Optional } ); - config.EnableCors(new EnableCorsAttribute("*", "*", "*", "*")); + AppSettingsReader reader = new AppSettingsReader(); + string clientUrl = reader.GetValue("clientUrl", typeof(string)).ToString(); + + config.EnableCors(new EnableCorsAttribute(clientUrl, "*", "*", "*")); } } } diff --git a/src/MultiChannelToDo/Controllers/ToDoItemsController.cs b/src/MultiChannelToDo/Controllers/ToDoItemsController.cs index 1fd8a1c..c0f1fd1 100644 --- a/src/MultiChannelToDo/Controllers/ToDoItemsController.cs +++ b/src/MultiChannelToDo/Controllers/ToDoItemsController.cs @@ -11,7 +11,6 @@ namespace MultiChannelToDo.Controllers { - [EnableCors("*", "*", "*", SupportsCredentials = false)] public class ToDoItemsController : ApiController { private MultiChannelToDoContext db = new MultiChannelToDoContext(); diff --git a/src/MultiChannelToDo/Global.asax.cs b/src/MultiChannelToDo/Global.asax.cs index fa96eda..6079184 100644 --- a/src/MultiChannelToDo/Global.asax.cs +++ b/src/MultiChannelToDo/Global.asax.cs @@ -1,5 +1,6 @@ using System.Net.Http.Formatting; using System.Web.Http; +using System.Web.Http.Cors; namespace MultiChannelToDo { diff --git a/src/MultiChannelToDo/Migrations/201504231007334_Initialize Database.Designer.cs b/src/MultiChannelToDo/Migrations/201504231007334_Initialize Database.Designer.cs new file mode 100644 index 0000000..1d1467b --- /dev/null +++ b/src/MultiChannelToDo/Migrations/201504231007334_Initialize Database.Designer.cs @@ -0,0 +1,29 @@ +// +namespace MultiChannelToDo.Migrations +{ + using System.CodeDom.Compiler; + using System.Data.Entity.Migrations; + using System.Data.Entity.Migrations.Infrastructure; + using System.Resources; + + [GeneratedCode("EntityFramework.Migrations", "6.1.2-31219")] + public sealed partial class InitializeDatabase : IMigrationMetadata + { + private readonly ResourceManager Resources = new ResourceManager(typeof(InitializeDatabase)); + + string IMigrationMetadata.Id + { + get { return "201504231007334_Initialize Database"; } + } + + string IMigrationMetadata.Source + { + get { return null; } + } + + string IMigrationMetadata.Target + { + get { return Resources.GetString("Target"); } + } + } +} diff --git a/src/MultiChannelToDo/Migrations/201504231007334_Initialize Database.cs b/src/MultiChannelToDo/Migrations/201504231007334_Initialize Database.cs new file mode 100644 index 0000000..b0160ef --- /dev/null +++ b/src/MultiChannelToDo/Migrations/201504231007334_Initialize Database.cs @@ -0,0 +1,30 @@ +namespace MultiChannelToDo.Migrations +{ + using System; + using System.Data.Entity.Migrations; + + public partial class InitializeDatabase : DbMigration + { + public override void Up() + { + CreateTable( + "mobile_service_name.TodoItems", + c => new + { + Id = c.String(nullable: false, maxLength: 128), + Text = c.String(), + Complete = c.Boolean(nullable: false), + CreatedAt = c.DateTimeOffset(precision: 7), + UpdatedAt = c.DateTimeOffset(precision: 7), + Deleted = c.Boolean(nullable: false), + }) + .PrimaryKey(t => t.Id); + + } + + public override void Down() + { + DropTable("mobile_service_name.TodoItems"); + } + } +} diff --git a/src/MultiChannelToDo/Migrations/201504231007334_Initialize Database.resx b/src/MultiChannelToDo/Migrations/201504231007334_Initialize Database.resx new file mode 100644 index 0000000..56c9514 --- /dev/null +++ b/src/MultiChannelToDo/Migrations/201504231007334_Initialize Database.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + H4sIAAAAAAAEAM1YzW7jNhC+F+g7CDq1QNZMsoemgbyLrJwUQddxsHL2uqClkU2UIlWSMuxn66GP1Ffo0Po15d9kURS+WMOZjzPDmY8j/fPX38HHVca9JSjNpBj6V4NL3wMRy4SJ+dAvTPruxv/44ccfgvskW3lfa733Vg8thR76C2PyW0J0vICM6kHGYiW1TM0glhmhiSTXl5e/kqsrAgjhI5bnBV8KYVgGmwd8DKWIITcF5WOZANeVHFeiDar3RDPQOY1h6I8Lbli4oEIAn8qRHJQmvnfHGUV3IuCp7+GyNNSgs7cvGiKjpJhHOQoon65zQL2Ucg1VELet+qnxXF7beEhrWEPFhTYyOxPw6n2VIOKavyrNfpNATOE9ptqsbdSbNA79qUzko4HM99zNbkOurOLeLA9q2wvP1bhoqgOLyP4uvBBVCgVDAYVRlF94z8WMs/h3WE/lHyCGouC86yo6i2tbAhQ9K5mDMusvkFYBPCa+R7btiGvYmHVsytCwGLC4fW9MV59BzM0Cy/76xvce2AqSWlJVx4tg2AtoZFSBj0/oMJ1xaNbJwT2nsDIHdsW/J+16eJNQZjkHA/VGn6TkQMXZzoYKqIHkrvF4hI9TbNJJmmowx8xf8uQt5iOwMSTnBRGQtrb7FY+kYigToKot3IK165sD6nUBMkbVCLo6g23fS/wITNNQo01TIAm1DpVMNGibbZfnjY8t45GS8mpqJHu4MRjTPMeK6nBlJfGikijDd9H55JGVGCTWOzik8bbZyUhF5+Cs2ppM4IEpbbAI6IzacwuTrKe270T2ZLve1U26SxjtGdQW9v/uInB5zQVr0/qAkWYgzCZoaJzq0GnPdHN/UU7VDi4KJS8ysY/PDlmXrNK1LyWnI7SU0UVppWcgtaSxBdWKT8fqMEgXqyM+Hauhky5SI+zjBMQ5ZbemSK+onPvHrdJDze6qNLs3Te80d1A12vHpqNd5pYrvYYKWLLFdF601VuvAKgyiP3nIGcbbKoypYCloU17RPhLDjTNb/X/mHKJ1wk8cdv7zOUMsqYoXVPUnjTeMETXoTxld/dxFes2oMGPm7WOC7U47y8vqnn9WELPyLeGXcx3sDRHfE9wZMY4Hf9540b/zjg0N9WBwYGYou3foZ3LGOHzToJYshm8CETCO0vNaW796xOizS0C6b2jBCDSbtxD2fU1AbNu2Ba11HkUq68xjtF2PahXnYMZgKB40vVOGpTQ2uByD1ptx+SvlBarcZzNIHsWkMHlh7rSGbMbX3XgDcnj/zRy17XMwye2T/h4hoJvM1upEfCoYTxq/H3ZU1R4IWz+/Aco3dIivCwg3XzdIT1KcCFSlbwQ5iASpfQrY9QimJyKiS3iNbzgQf4Y5jdf1JbEf5PhBbKc9GDE6VzTTFUZrb786EPvZ4cO/tFgGF6gQAAA= + + + mobile_service_name + + \ No newline at end of file diff --git a/src/MultiChannelToDo/Migrations/Configuration.cs b/src/MultiChannelToDo/Migrations/Configuration.cs new file mode 100644 index 0000000..45c95cd --- /dev/null +++ b/src/MultiChannelToDo/Migrations/Configuration.cs @@ -0,0 +1,58 @@ +namespace MultiChannelToDo.Migrations +{ + using System; + using System.Data.Entity; + using System.Data.Entity.Migrations; + using System.Linq; + using MultiChannelToDo.Models; + using System.Collections.Generic; + + internal sealed class Configuration : DbMigrationsConfiguration + { + public Configuration() + { + AutomaticMigrationsEnabled = false; + } + + protected override void Seed(MultiChannelToDo.Models.MultiChannelToDoContext context) + { + context.ToDoItems.AddRange(new List { + new TodoItem + { + Id = Guid.NewGuid().ToString(), + Text = "Build Sample", + Complete = false, + Deleted = false, + UpdatedAt = DateTimeOffset.UtcNow, + CreatedAt = DateTimeOffset.UtcNow + }, + new TodoItem + { + Id = Guid.NewGuid().ToString(), + Text = "Create ARM Template", + Complete = false, + Deleted = false, + UpdatedAt = DateTimeOffset.UtcNow, + CreatedAt = DateTimeOffset.UtcNow + }, + new TodoItem + { + Id = Guid.NewGuid().ToString(), + Text = "Publish to Azure", + Complete = false, + Deleted = false, + UpdatedAt = DateTimeOffset.UtcNow, + CreatedAt = DateTimeOffset.UtcNow + }, + new TodoItem + { + Id = Guid.NewGuid().ToString(), + Text = "Make Money", + Complete = false, + Deleted = false, + UpdatedAt = DateTimeOffset.UtcNow, + CreatedAt = DateTimeOffset.UtcNow + }}); + } + } +} diff --git a/src/MultiChannelToDo/MultiChannelToDo.csproj b/src/MultiChannelToDo/MultiChannelToDo.csproj index 9014114..1525c2c 100644 --- a/src/MultiChannelToDo/MultiChannelToDo.csproj +++ b/src/MultiChannelToDo/MultiChannelToDo.csproj @@ -130,6 +130,11 @@ Global.asax + + + 201504231007334_Initialize Database.cs + + @@ -140,6 +145,11 @@ + + + 201504231007334_Initialize Database.cs + + 10.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) diff --git a/src/MultiChannelToDo/Web.config b/src/MultiChannelToDo/Web.config index fb6c18f..e02e26a 100644 --- a/src/MultiChannelToDo/Web.config +++ b/src/MultiChannelToDo/Web.config @@ -2,7 +2,11 @@
- + + + + +