示例#1
0
        public IActionResult Edit(string id, RandomCamModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var result = this.camera.ById(int.Parse(id));

            if (User.Identity.Name != result.UserName)
            {
                return(RedirectToAction(nameof(All)));
            }

            this.camera.Edit(
                int.Parse(id),
                model.Make,
                model.CameraModel,
                model.Price,
                model.Quantity,
                model.MinShutterSpeed,
                model.MaxShutterSpeed,
                model.MinISO,
                model.MaxISO,
                model.IsFullFrame,
                model.VideoResolution,
                model.Description,
                model.ImageUrl
                );

            return(RedirectToAction(nameof(All)));
        }
示例#2
0
        public IActionResult Delete(int id, RandomCamModel model)
        {
            this.camera.Delete(id);

            return(RedirectToAction(nameof(All)));
        }