Example #1
0
        public IActionResult DeleteLand(int id) // Usuwa również field który był powiązany !!!
        {
            var model      = _fieldService.GetAllFieldForList(id);
            var landUserId = _landService.GetLandById(id).UserId;

            if (landUserId != userId)
            {
                return(RedirectToAction("Index"));
            }
            if (model.Count == 0)
            {
                _landService.DeleteLand(id);
                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
Example #2
0
        public IActionResult AddSowing()
        {
            var modelFields      = _fieldService.GetAllFieldForList(userId).Fields;
            var fieldsSelectList =
                modelFields.Select(f => new SelectListItem(f.FieldName, Convert.ToString(f.Id))).ToList();

            var typeSowingSelectList = _typeSowingService.GetAllTypeSowingFotSelectList();

            var model = new NewSowingVm()
            {
                Field      = fieldsSelectList,
                TypeSowing = typeSowingSelectList
            };

            return(View(model));
        }
Example #3
0
        public IActionResult Index()
        {
            var model = _fieldService.GetAllFieldForList(userId);

            return(View(model));
        }