public ActionResult EditPackage(PackageModel packageDetails)
 {
     if (ModelState.IsValid)
     {
         var currentUser = Request.GetOwinContext().Authentication.User.Identity.GetUserId();
         _instructorRepo.UpdatePackageDetails(currentUser, packageDetails);
         return View("Packages");
     }
     return View();
 }
示例#2
0
        public void UpdatePackageDetails(string userId, PackageModel package)
        {
            var packageDetails = DataContext.Package_Details.FirstOrDefault(s => s.PackageId == package.PackageId) ??
                                 new Package_Details();
            packageDetails.ModifiedBy = userId;
            packageDetails.ModifiedDate = DateTime.Now;
            packageDetails.Name = package.Name;
            packageDetails.Description = package.Description;
            packageDetails.NumberOfHours = package.Hours;
            packageDetails.Cost = package.Cost;
            packageDetails.Type = string.Empty;


            if (packageDetails.PackageId == 0)
            {
                packageDetails.CreatedDate = DateTime.Now;
                packageDetails.CreatedBy = userId;
                DataContext.Package_Details.Add(packageDetails);
            }

            SaveInDatabase();
        }
 public void UpdatePackageDetails(PackageModel packageDetails)
 {
     var currentUser = Request.GetOwinContext().Authentication.User.Identity.GetUserId();
     _instructorRepo.UpdatePackageDetails(currentUser, packageDetails);
 }
示例#4
0
        public void CreateNewPackage(string userId, PackageModel package)
        {
            var packageDetails = new Package_Details
            {
                ModifiedBy = userId,
                ModifiedDate = DateTime.Now,
                Name = package.Name,
                Description = package.Description,
                NumberOfHours = package.Hours,
                Cost = package.Cost,
                Type = string.Empty,
            };

            if (packageDetails.PackageId == 0)
            {
                packageDetails.CreatedDate = DateTime.Now;
                packageDetails.CreatedBy = userId;
                DataContext.Package_Details.Add(packageDetails);
            }

            SaveInDatabase();
        }