Beispiel #1
0
        internal void AddCamera(ApplicationUser seller, Camera cam)
        {
            var context = HttpContext.Current.GetOwinContext().Get<ApplicationDbContext>();

            context.Cameras.Add(cam);
            context.SaveChanges();
            ReCalculatePoints(seller);

        }
Beispiel #2
0
        public async Task<ActionResult> AddCamera(CameraViewModel model)
        {
            

            if (ModelState.IsValid)
            {
                var LoggedInUser = await UserManager.FindByIdAsync(User.Identity.GetUserId());

                if (!LoggedInUser.Approved)
                    return RedirectToAction("Index", "Manage");


                var cam = new Camera() { CameraName = model.AddCameraViewModel.CameraName, CameraSerialNumber = model.AddCameraViewModel.CameraSerialNumber, CameraRecipeNumber = model.AddCameraViewModel.CameraRecipeNumber, User = LoggedInUser, Date = DateTime.Now };
                FujiRepository.AddCamera(LoggedInUser, cam);
                FujiRepository.ReCalculatePoints(LoggedInUser);

            }


            return RedirectToAction("Index");
        }