public void MaterialInfoUpdate() { if (session.IsAuthorised) { materialService.ShowMaterials(); string name = string.Empty; name = InfoUnit.GetInfoUnit( name, x => !(string.IsNullOrEmpty(x.ToString())), "Enter name of the material you want to edit", "Error! Name is invalid" ).ToString(); var material = materialService.Get(name); string field = string.Empty; field = InfoUnit.GetInfoUnit( field, x => !(string.IsNullOrEmpty(x.ToString()) && new List <string> { "1", "2", "3" }.Contains(x.ToString())), "Enter name of the field you want to edit: \n 1.Name \n 2.Link \n 3.Skills", "Error! Field is invalid" ).ToString(); if (field == "1") { var newName = string.Empty; newName = InfoUnit.GetInfoUnit( newName, x => !(string.IsNullOrEmpty(x.ToString())), "Enter new name", "Error! Name is invalid" ).ToString(); materialService.Update(material.Name, newName, null); } if (field == "2") { var newLink = string.Empty; newLink = InfoUnit.GetInfoUnit( newLink, x => !(string.IsNullOrEmpty(x.ToString())), "Enter new description", "Error! Description is invalid" ).ToString(); materialService.Update(material.Name, null, newLink); } if (field == "3") { Console.WriteLine(material); var command = string.Empty; command = InfoUnit.GetInfoUnit( command, x => !(string.IsNullOrEmpty(x.ToString())) && new List <string> { "1", "2" }.Contains(x.ToString()), "Wanna add new skills(1), add existing(2) or delete some (3)", "Error! command is invalid" ).ToString(); if (command == "1") { var skillName = skillInputService.SkillInfoInput(); var skill = skillService.Get(skillName); materialService.AddSkillToMaterial(material.Name, skill); } if (command == "2") { skillService.ShowSkills(); var skillName = string.Empty; skillName = InfoUnit.GetInfoUnit( skillName, x => !(string.IsNullOrEmpty(x.ToString())), "Enter skill name", "Error! Skill name is invalid" ).ToString(); var skill = skillService.Get(skillName); materialService.AddSkillToMaterial(material.Name, skill); } if (command == "3") { var skillName = string.Empty; skillName = InfoUnit.GetInfoUnit( skillName, x => !(string.IsNullOrEmpty(x.ToString())), "Enter material name", "Error! Material name is invalid" ).ToString(); var skill = skillService.Get(skillName); //skillService.Delete(material.Id); } } else { Console.WriteLine("You need to authorize"); } } }