public async Task <ResultModel> UpdateVehicle(int id, [FromBody] Vehicle vehicle) { try { bool response = await _vehicleRepository.UpdateVehicleAsync(id, vehicle); return(ResponceModel.GetUpdatedResponse(response, id)); } catch (Exception ex) { var st = new StackTrace(); return(ResponceModel.GetExceptionResponse(ex, st.GetFrame(0).GetMethod().DeclaringType.FullName)); } }
public async Task <ResultModel> UploadProfileImage(int id, [FromForm] IFormFile file) { try { string fName = file.FileName; string imagesPath = @"ProfileImages/" + file.FileName; string path = Path.Combine(_environment.ContentRootPath, imagesPath); using (var stream = new FileStream(path, FileMode.Create)) { await file.CopyToAsync(stream); } bool response = await _userRepository.UploadProfileImageAsync(id, imagesPath); return(ResponceModel.GetUpdatedResponse(response, id)); } catch (Exception ex) { var st = new StackTrace(); return(ResponceModel.GetExceptionResponse(ex, st.GetFrame(0).GetMethod().DeclaringType.FullName)); } }