public IActionResult Rename(int teamId, string name) { if (string.IsNullOrEmpty(name) || string.IsNullOrWhiteSpace(name)) { return(Json(new { success = false, errorMessage = "Team name cannot be empty." })); } var team = _teamRepository.Get(teamId); if (team == null) { return(Json(new { success = false, errorMessage = "Invalid Team." })); } team.Name = name; _teamManager.Save(team); return(Json(new { success = true })); }
public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } var member = _teamManage.Find(Id.Value); member.Name = CurrentMember.Name; member.Title = CurrentMember.Title; member.Description = CurrentMember.Description; if (Image != null) { using (var stream = new System.IO.MemoryStream()) { Image.CopyTo(stream); member.Image = stream.ToArray(); member.ImageContentType = Image.ContentType; } } _teamManage.Save(member); return(RedirectToPage("/Team/Team")); }
public IActionResult OnPost() { if (Image != null) { using (var stream = new System.IO.MemoryStream()) { Image.CopyTo(stream); Member.Image = stream.ToArray(); Member.ImageContentType = Image.ContentType; } } _teamManage.Save(Member); return(RedirectToPage("/Team/Team")); }