Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Checkpoint#1-repeat
Submodule Checkpoint#1-repeat added at 23184d
145 changes: 145 additions & 0 deletions Checkpoint#1/BellaSalon/BellaSalon/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using BellaSalon.Models;

namespace BellaSalon.Controllers
{
public class HomeController : Controller
{
public IActionResult CustomerIndex()
{
return View(Repository.Customers);
}

[HttpGet]
public IActionResult CustomerCreate()
{
return View();
}

[HttpPost]
public IActionResult CustomerCreate(Customer customer)
{
if (!ModelState.IsValid)
{
return View();
}
Repository.CustomerAdd(customer);
return View("CustomerIndex", Repository.Customers);
}

public IActionResult CustomerDelete(Guid ID)
{
var DelCustomer = Repository.Customers.ToList().Find(c => c.ID == ID);
Repository.CustomerRemove(DelCustomer);
return View("CustomerIndex", Repository.Customers);
}

public IActionResult ServiceProviderIndex()
{
return View(Repository.ServiceProviders);
}

[HttpGet]
public IActionResult ServiceProviderCreate()
{
return View();
}

[HttpPost]
public IActionResult ServiceProviderCreate(ServiceProvider serviceProvider)
{
if (!ModelState.IsValid)
{
return View();
}
Repository.ServiceProviderAdd(serviceProvider);
return View("ServiceProviderIndex", Repository.ServiceProviders);
}

public IActionResult ServiceProviderDelete(Guid ID)
{
var DelServiceProvider = Repository.ServiceProviders.ToList().Find(s => s.ID == ID);
Repository.ServiceProviderRemove(DelServiceProvider);
return View("ServiceProviderIndex", Repository.ServiceProviders);
}

public IActionResult AppointmentsByDate(string name)
{
var SPAppointments = Repository.Appointments.Where(a => a.ServiceProvider == name).ToList();

ViewBag.SPAppointments = SPAppointments.OrderBy(a => a.Date).ThenBy(a => a.Time).ToList();
ViewBag.ServiceProvider = name;
ViewBag.Customers = Repository.Customers.ToList();
return View();
}

public IActionResult AppointmentIndex()
{
return View(Repository.Appointments);
}

[HttpGet]
public IActionResult AppointmentCreate()
{
return View();
}

[HttpPost]
public IActionResult AppointmentCreate(Appointment appointment)
{
bool custExists = false;
bool serviceProviderExists = false;
bool doubleBooked = false;
foreach (var c in Repository.Customers)
{
if (appointment.Customer == c.Name)
custExists = true;
}
foreach (var s in Repository.ServiceProviders)
{
if (appointment.ServiceProvider == s.Name)
serviceProviderExists = true;
}
foreach (var a in Repository.Appointments)
{
if (appointment.Date == a.Date && appointment.Time == a.Time && (appointment.Customer == a.Customer || appointment.ServiceProvider == a.ServiceProvider))
{
doubleBooked = true;
}
}
if (custExists && serviceProviderExists && !doubleBooked)
{
Repository.AddAppointment(appointment);
}
else
{
ViewBag.error = "Invalid Appointment";
}
return View("AppointmentIndex", Repository.Appointments.OrderBy(a => a.Date).ThenBy(a => a.Time));
}

public IActionResult AppointmentDelete(Guid ID)
{
var DelAppointment = Repository.Appointments.ToList().Find(a => a.ID == ID);
Repository.AppointmentRemove(DelAppointment);
return View("AppointmentIndex", Repository.Appointments);
}

public IActionResult Index()
{
ViewData["message"] = "Bella's Spa and Nails";
return View("BellaSalon");
}

public IActionResult Home()
{
return View("Home");
}
}
}

8 changes: 8 additions & 0 deletions Checkpoint#1/BellaSalon/BellaSalon/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*"
}
25 changes: 25 additions & 0 deletions Lesson00/Lesson00.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2041
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson00", "Lesson00\Lesson00.csproj", "{4F43B228-7AA6-4C0F-B523-AAE4115F9C43}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4F43B228-7AA6-4C0F-B523-AAE4115F9C43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4F43B228-7AA6-4C0F-B523-AAE4115F9C43}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F43B228-7AA6-4C0F-B523-AAE4115F9C43}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4F43B228-7AA6-4C0F-B523-AAE4115F9C43}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1530CDFB-343E-4D96-B969-BD5012042B87}
EndGlobalSection
EndGlobal
22 changes: 22 additions & 0 deletions Lesson00/Lesson00/Controllers/OneController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Lesson00.Models;
using System;
using System.Collections.Generic;
using System.Text;

namespace Lesson00.Controllers
{
class OneController
{
public SingleModel singleModel;
public void Form()
{
singleModel = Views.One.Form.EnterChar();
}
public void Index()
{
Views.One.Index.Result(singleModel);
}


}
}
8 changes: 8 additions & 0 deletions Lesson00/Lesson00/Lesson00.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

</Project>
12 changes: 12 additions & 0 deletions Lesson00/Lesson00/Models/SingleModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Lesson00.Models
{
class SingleModel
{
public string Character { get; set; }
public int AmountTimes { get; set; }
}
}
15 changes: 15 additions & 0 deletions Lesson00/Lesson00/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Lesson00.Controllers;
using System;

namespace Lesson00
{
class Program
{
static void Main(string[] args)
{
OneController oneController = new OneController();
oneController.Form();
oneController.Index();
}
}
}
23 changes: 23 additions & 0 deletions Lesson00/Lesson00/Views/One/Form.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Lesson00.Models;
using System;
using System.Collections.Generic;
using System.Text;

namespace Lesson00.Views.One
{
class Form
{
public static SingleModel singleModel = new SingleModel();

public static SingleModel EnterChar()
{
Console.WriteLine("\n\t\t\t\tPlease enter any character:");
singleModel.Character = Console.ReadLine();

Console.WriteLine("\t\tHow many times do you want me to repeat this character?");
singleModel.AmountTimes = Convert.ToInt32(Console.ReadLine());

return singleModel;
}
}
}
22 changes: 22 additions & 0 deletions Lesson00/Lesson00/Views/One/Index.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Lesson00.Models;
using System;
using System.Collections.Generic;
using System.Text;

namespace Lesson00.Views.One
{
class Index
{
static string result = "" + new string(' ', 43);
public static void Result(SingleModel singleModel)
{
for (int i = 0; i < singleModel.AmountTimes; i++)
{
result = result + singleModel.Character;
}

Console.WriteLine(result);
Console.ReadLine();
}
}
}
25 changes: 25 additions & 0 deletions lesson02/homework2/StartOfLesson/ToDo.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2019
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToDo", "ToDo\ToDo.csproj", "{2B335EC8-68FE-47D3-AFB5-84FF4340798E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2B335EC8-68FE-47D3-AFB5-84FF4340798E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2B335EC8-68FE-47D3-AFB5-84FF4340798E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2B335EC8-68FE-47D3-AFB5-84FF4340798E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2B335EC8-68FE-47D3-AFB5-84FF4340798E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6B4B796A-0430-4BBA-AE2A-5CB27CE6CB47}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using ToDoApp.Models;

namespace ToDoApp.Controllers
{

public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}

public IActionResult About()
{
ViewData["Message"] = "Your application description page.";

return View();
}

public IActionResult Contact()
{
ViewData["Message"] = "Your contact page.";

return View();
}

public IActionResult Privacy()
{
return View();
}

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace ToDoApp.Controllers
{
internal class SocialMediaModel
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ToDoApp.Controllers
{
public class SocialMediaViewComponent : ViewComponent
{
public SocialMediaViewComponent()
{
}
public IViewComponentResult Invoke(string socialMediaType)
{
return View("Default", socialMediaType);
}
}
}
Loading