public async Task <IActionResult> updateTeacher(int id, [FromBody] TeacherResource resource) { var teacher = await ITeacher.getTeacher(id); mapper.Map <TeacherResource, Teachers>(resource, teacher); updateDetails(); return(Ok(mapper.Map <Teachers, TeacherResource>(teacher))); }
public string getResources(string folderPath) { string[] resultFile; string[] resultDirectories; HttpCookie cookie = Request.Cookies["Account"]; User u = dbHelper.findUser(cookie["userName"]); if (folderPath == "") { folderPath = "/" + u.userName; } /* else * { * folderPath = folderPath.Replace(",", "/"); * } */ var severPath = this.Server.MapPath("/TeacherResource" + folderPath + "/"); upFilePath = severPath; Directory.CreateDirectory(severPath); try { resultFile = Directory.GetFiles(severPath); resultDirectories = Directory.GetDirectories(severPath); } catch (Exception e) { return("error"); } TeacherResource resource = new TeacherResource(); resource.files = resultFile; resource.directories = resultDirectories; return(JsonConvert.SerializeObject(resource)); }