public void Add() { if (!IsEdit) { string x = RankService.Add(Name, Description, Bonus, CanLead, MinExperience); if (x == null) { TryClose(); } else { Error = x; } } else { toEdit.Name = Name; toEdit.Description = Description; toEdit.Bonus = Bonus; toEdit.CanLead = CanLead; toEdit.MinExperience = MinExperience; string x = RankService.Edit(toEdit); if (x == null) { TryClose(); } else { Error = x; } } }