public IHttpActionResult EditProfile() { // Passing information from form to DTO ProfileDTO obj = new ProfileDTO(); obj.UserName = HttpContext.Current.Request.Params["UserName"]; obj.FirstName = HttpContext.Current.Request.Params["FirstName"]; obj.LastName = HttpContext.Current.Request.Params["LastName"]; obj.Email = HttpContext.Current.Request.Params["Email"]; obj.Description = HttpContext.Current.Request.Params["Description"]; obj.SkillLevel = HttpContext.Current.Request.Params["SkillLevel"]; obj.Gender = HttpContext.Current.Request.Params["Gender"]; obj.ProfilePicture = HttpContext.Current.Request.Params["ProfilePicture"]; // Checking if profile image is being updated obj.IsUpdatingProfileImage = HttpContext.Current.Request.Params["IsThereImage"]; HttpPostedFile imageFile = null; // Creates service to handle request UserProfileService service = new UserProfileService(); // Get image if being updated if (obj.IsUpdatingProfileImage == "true") { imageFile = HttpContext.Current.Request.Files[0]; } // Pressing request var response = service.EditProfile(obj, imageFile); // Was it successful? if (!response.IsSuccessful) { return(Content(HttpStatusCode.BadRequest, "Error: " + response.Messages)); } return(Content(HttpStatusCode.OK, "Operation was successful? " + response.IsSuccessful)); }