public async Task <IActionResult> Create([Bind("ImageId,Title,ImageFile,HockeyGameId")] ImageModel imageModel) { if (ModelState.IsValid) { var nBSContext = _context.Images .Include(i => i.HockeyGame); //Save image to wwwwroot/Image ! string wwwwRootPath = _hostEnvironment.WebRootPath; string fileName = Path.GetFileNameWithoutExtension(imageModel.ImageFile.FileName); string extension = Path.GetExtension(imageModel.ImageFile.FileName); imageModel.ImageName = fileName = fileName + DateTime.Now.ToString("yymmssfff") + extension; string path = Path.Combine(wwwwRootPath + "/Image/", fileName); using (var fileStream = new FileStream(path, FileMode.Create)) { await imageModel.ImageFile.CopyToAsync(fileStream); } //Insert record ! _context.Add(imageModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(IndexSearch))); } return(View(imageModel)); }
public async Task <IActionResult> Create([Bind("Id,GroupName,Speaker,MatchClock,MatchProtocol,BoothDoor1,BoothDoor2,ShotStatistics,DiscJockey,Referee1,Referee2,LinesMan1,LinesMan2,Supervisor")] OfficialsGroup officialsGroup) { if (ModelState.IsValid) { _context.Add(officialsGroup); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(officialsGroup)); }
public async Task <IActionResult> Create([Bind("Id,ClubNumber,ClubName")] Club club) { if (ModelState.IsValid) { _context.Add(club); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(club)); }
public async Task <IActionResult> Create([Bind("Id,ActivityPostStatusName")] ActivityPostStatus activityPostStatus) { if (ModelState.IsValid) { _context.Add(activityPostStatus); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(activityPostStatus)); }
public async Task <IActionResult> Create([Bind("Id,TSMSeriesName")] TSMSeries tSMSeries) { if (ModelState.IsValid) { _context.Add(tSMSeries); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tSMSeries)); }
public async Task <IActionResult> Create([Bind("Id,HealthActivityName,KcalPerHour")] HealthActivity healthActivity) { if (ModelState.IsValid) { _context.Add(healthActivity); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(healthActivity)); }
public async Task <IActionResult> Create([Bind("Id,ArenaNumber,ArenaName,StreetAddress,ZipCode,City,Country")] Arena arena) { if (ModelState.IsValid) { _context.Add(arena); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(arena)); }
public async Task <IActionResult> Create([Bind("Id,DateTimePosted,DateTimeChanged,FoodRatingNumber,FoodRatingName,FoodRatingDescription")] FoodRating foodRating) { if (ModelState.IsValid) { _context.Add(foodRating); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(foodRating)); }
public async Task <IActionResult> Create([Bind("Id,DateTimePosted,DateTimeChanged,FoodName,FoodNumber,FoodDescription,EnergyKcal,EnergyKJ,Carbohydrates,Fat,Protein,Fibers,Water,Alcohol,Ash,Monosaccharides,Disaccharides,Sucrose,WholeGrainsTotal,Sugars,TotalSaturatedFattyAcids,FattyAcid40100,LauricAcidC120,MyristicAcidC140,PalmiticAcidC160,StearinAcid180,ArachidicAcidC200,TotalMonounsaturatedFattyAcids,PalmOleicAcidC161,OleicAcidC181,TotalPolyunsaturatedFattyAcids,LinoleAcidC182,LinolenicAcidC183,ArachidonicAcidC204,EPAC205,DPAC225,DHAC226,Cholesterol,Retinol,VitaminA,BetaCarotene,VitaminD,VitaminE,VitaminK,Thiamine,Riboflavin,VitaminC,Niacin,NiacinEquivalents,VitaminB6,VitaminB12,Folate,Phosphorus,Iodine,Iron,Calcium,Potassium,Magnesium,Sodium,Salt,Selenium,Zink,WasteProcent")] Food food) { if (ModelState.IsValid) { _context.Add(food); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(food)); }
public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,StreetAddress,ZipCode,City,Country,Ssn,PhoneNumber1,PhoneNumber2,PrivateEmail,ApplicationUserId")] Referee referee) { if (ModelState.IsValid) { _context.Add(referee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = new SelectList(_context.Users, "Id", "FullName", referee.ApplicationUserId); return(View(referee)); }
public async Task <IActionResult> Create([Bind("Id,RefereeId,Date,BodyTemp,SoreThroat,NasalCongestion,Cough,Headache,Nausea,Diarrhea,MuscleAches,OtherSymptoms,OtherSymptomsDescription,FamilySymtoms")] MDProtocol mDProtocol) { if (ModelState.IsValid) { _context.Add(mDProtocol); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["RefereeId"] = new SelectList(_context.Referee, "Id", "FullName", mDProtocol.RefereeId); return(View(mDProtocol)); }
public async Task <IActionResult> Create([Bind("Id,DateTimePosted,DateTimeChanged,ApplicationUserId,DateTime,Meal,Calories,Fat,SaturatedFat,PolyunsaturatedFat,MonounsaturatedFat,TransFat,Cholesterol,Sodium,Potassium,Carbohydrates,Fibers,Sugar,Protein,VitaminA,VitaminC,Calcium,Iron,Notes")] FoodDiaryPost foodDiaryPost) { if (ModelState.IsValid) { _context.Add(foodDiaryPost); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = new SelectList(_context.Users, "Id", "FullName", foodDiaryPost.ApplicationUserId); return(View(foodDiaryPost)); }
public async Task <IActionResult> Create([Bind("Id,DateTimePosted,DateTimeChanged,ApplicationUserId,EmployeeNumber,Name,Address,PhoneNumbers")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = new SelectList(_context.Users, "Id", "FullName", employee.ApplicationUserId); return(View(employee)); }
public async Task <IActionResult> Create([Bind("Id,DateTimePosted,DateTimeChanged,ProjectPostDescription,DateTimePlaned,DateTimeStarted,DateTimeDone,HourPrice,TimeEstimate,TotalCostEstimate,TimeActual,MtrCostActual,LabourCostActual,TotalCostActual,ProjectPostStatusId")] ProjectPost projectPost) { if (ModelState.IsValid) { _context.Add(projectPost); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ProjectPostStatusId"] = new SelectList(_context.Set <ProjectPostStatus>(), "Id", "Id", projectPost.ProjectPostStatusId); return(View(projectPost)); }
public async Task <IActionResult> CreatePlanPost([Bind("Id,DateTimePosted,DateTimeChanged,ApplicationUserId,PlanedDateTime,StartDateTime,EndDateTime,AktivitetId,Description")] PlanPost planPost) { if (ModelState.IsValid) { _context.Add(planPost); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(IndexPlanPosts))); } ViewData["AktivitetId"] = new SelectList(_context.Set <Aktivitet>(), "Id", "AktivitetsBeskrivning", planPost.AktivitetId); ViewData["ApplicationUserId"] = new SelectList(_context.Users, "Id", "FullName", planPost.ApplicationUserId); return(View(planPost)); }
public async Task <IActionResult> Create([Bind("Id,GameDate,PaymentDate,Description,ClubId,PaymentBeforeTax,Tax,Payment,CSPStatusId")] CleverServicePayments cleverServicePayments) { if (ModelState.IsValid) { _context.Add(cleverServicePayments); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CSPStatusId"] = new SelectList(_context.Set <CSPStatus>(), "Id", "CSPStatusName", cleverServicePayments.CSPStatusId); ViewData["ClubId"] = new SelectList(_context.Club, "Id", "ClubName", cleverServicePayments.ClubId); return(View(cleverServicePayments)); }
public async Task <IActionResult> Create([Bind("Id,DateTimePosted,DateTimeChanged,DateTimeStarted,DateTimeEnded,HoursSpent,MinutesSpent,SecondsSpent,ApplicationUserId,HealthActivityId,ActivityPostStatusId,Description,Location")] ActivityPost activityPost) { if (ModelState.IsValid) { _context.Add(activityPost); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ActivityPostStatusId"] = new SelectList(_context.Set <ActivityPostStatus>(), "Id", "ActivityPostStatusName", activityPost.ActivityPostStatusId); ViewData["HealthActivityId"] = new SelectList(_context.Set <HealthActivity>(), "Id", "HealthActivityName", activityPost.HealthActivityId); ViewData["ApplicationUserId"] = new SelectList(_context.Users, "Id", "FullName", activityPost.ApplicationUserId); return(View(activityPost)); }
public async Task <IActionResult> AddProjectPost([Bind("Id,DateTimePosted,DateTimeChanged,ProjectPostDescription," + "DateTimePlaned,DateTimeStarted,DateTimeDone,HourPrice,TimeEstimate,TotalCostEstimate,TimeActual,MtrCostActual,LabourCostActual,TotalCostActual,ProjectPostStatusId")] ProjectPost projectPost) { if (ModelState.IsValid) { var pROLabContext = _context.ProjectPosts .Include(p => p.Status); projectPost.TotalCostEstimate = (projectPost.TimeEstimate * projectPost.HourPrice) + projectPost.MtrCostActual; projectPost.TotalCostActual = (projectPost.TimeActual * projectPost.HourPrice) + projectPost.MtrCostActual; projectPost.LabourCostActual = projectPost.HourPrice * projectPost.TimeActual; _context.Add(projectPost); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(ListProjectPosts))); } ViewData["ProjectPostStatusId"] = new SelectList(_context.Set <ProjectPostStatus>(), "Id", "ProjectPostStatusName", projectPost.ProjectPostStatusId); return(View(projectPost)); }
public async Task <IActionResult> Create([Bind("Id,DateTimePosted,DateTimeChanged,GameDateTime,TSMNumber,ArenaId,ClubId,ClubId1,HomeTeamScore,AwayTeamScore,RefereeId,RefereeId1,RefereeId2,RefereeId3,TSMSeriesId")] TSMGame tSMGame) { if (ModelState.IsValid) { _context.Add(tSMGame); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ArenaId"] = new SelectList(_context.Arena, "Id", "ArenaName"); ViewData["ClubId1"] = new SelectList(_context.Club, "Id", "ClubName"); ViewData["RefereeId"] = new SelectList(_context.Referee, "Id", "FullName"); ViewData["RefereeId1"] = new SelectList(_context.Referee, "Id", "FullName"); ViewData["ClubId"] = new SelectList(_context.Club, "Id", "ClubName"); ViewData["RefereeId2"] = new SelectList(_context.Referee, "Id", "FullName"); ViewData["RefereeId3"] = new SelectList(_context.Referee, "Id", "FullName"); ViewData["TSMSeriesId"] = new SelectList(_context.Set <TSMSeries>(), "Id", "TSMSeriesName"); return(View()); }
public async Task <IActionResult> CreateUpload([Bind("UploadId,Title,UploadFile")] UploadModel uploadModel) { if (ModelState.IsValid) { //Save image to wwwwroot/Image ! string wwwwRootPath = _hostEnvironment.WebRootPath; string fileName = Path.GetFileNameWithoutExtension(uploadModel.UploadFile.FileName); string extension = Path.GetExtension(uploadModel.UploadFile.FileName); uploadModel.UploadName = fileName = fileName + DateTime.Now.ToString("yymmssfff") + extension; string path = Path.Combine(wwwwRootPath + "/Uploads/", fileName); using (var fileStream = new FileStream(path, FileMode.Create)) { await uploadModel.UploadFile.CopyToAsync(fileStream); } //Insert record ! _context.Add(uploadModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(ListUploads))); } return(View(uploadModel)); }
public async Task <IActionResult> CreateRefFee([Bind("Id,Category,UDZ,HD,LD")] RefFees refFees) { if (ModelState.IsValid) { _context.Add(refFees); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(IndexRefFees))); } return(View(refFees)); }
public async Task <IActionResult> RegisterCompany([Bind("Id,CompanyNumber,CompanyName,StreetAddress,ZipCode,City,Country,CompanyRoleId,CompanyStatusId,CompanyTypeId")] Company company) { if (ModelState.IsValid) { _context.Add(company); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(ListCompanies))); } ViewData["CompanyRoleId"] = new SelectList(_context.CompanyRoles, "Id", "CompanyRoleName", company.CompanyRoleId); ViewData["CompanyStatusId"] = new SelectList(_context.CompanyStatuses, "Id", "CompanyStatusName", company.CompanyStatusId); ViewData["CompanyTypeId"] = new SelectList(_context.CompanyTypes, "Id", "CompanyTypeName", company.CompanyTypeId); return(View(company)); }