Bobby Hayes

Bobby Hayes

  • NA
  • 3
  • 477

Problems with MVVM, Swagger API, SQL connection.

Dec 17 2019 11:32 PM

I tried to make that tile as descriptive as I possibly could. I am building a bug tracker (report tracker) that operates on C# / .Net Framework. Considering I am the only person I know that can program, I exhausted my resources early. I am firm believer that if you encounter a problem, whether that be in programming or just in life, you can take a step back and truly think it through. I have at least honed in on my issue, but I do need to reach out for help at this point.

I tried posting something similar to this on Stackoverflow, but I was unable to negotiate for actual help.

If you made it this far, and you plan on reading further, you may see things referenced that do not have any mention in the class below, it is most likely a relic of some problem I tried to fix, it has most likely shown to not be a cause for problems. You may also see things commented out, I tried to remove a majority of the those, but its possible I missed something.

I am using MVVM to collect the data inserted in Textboxes on my WPF.

  1. public class CreateReportViewModel : Conductor<object>   
  2. {   
  3.    IReportEndpoint _reportEndpoint;   
  4.    public CreateReportViewModel(IReportEndpoint reportEndpoint)   
  5.    {  
  6.     _reportEndpoint = reportEndpoint;   
  7.    }  
  8.    private DateTime _createDate;   
  9.    private string _userNameEmailAddress;   
  10.    private string _phoneNumber;   
  11.    private string _commentBox;   
  12.   
  13.    public DateTime CreateDate   
  14.    {   
  15.       getreturn _createDate; }   
  16.       set   
  17.       {  
  18.              _createDate = DateTime.Now;  
  19.              NotifyOfPropertyChange(() => CreateDate);}   
  20.      }   
  21.    public string UserNameEmailAddress     
  22.    {  
  23.        get { return _userNameEmailAddress; }   
  24.        set   
  25.         {   
  26.          _userNameEmailAddress = value;  
  27.          NotifyOfPropertyChange(() => UserNameEmailAddress);   
  28.          }   
  29.    }   
  30.    public string PhoneNumber   
  31.    {   
  32.       get { return _phoneNumber; }   
  33.       set   
  34.          {  
  35.           _phoneNumber = value;   
  36.          NotifyOfPropertyChange(() => PhoneNumber);   
  37.          }   
  38.    }  
  39.    public string CommentBox   
  40.    {   
  41.       get { return _commentBox; }   
  42.       set   
  43.       {  
  44.        _commentBox = value;   
  45.       NotifyOfPropertyChange(() => CommentBox);   
  46.       }   
  47.    }   
  48.      public async Task CreateReport()   
  49.      {   
  50.             try   
  51.             {   
  52.                      ReportModel report = new ReportModel();   
  53.   
  54.                     var result = await _reportEndpoint.PostReport(UserNameEmailAddress, PhoneNumber, CommentBox, CreateDate);   
  55.   
  56.                      await _reportEndpoint.PostReport(result.CommentBox, result.PhoneNumber, result.UserNameEmailAddress, res                     ult.CreateDate); }   
  57.             catch (Exception)   
  58.             {   
  59.                      throw;   
  60.             }  
  61.       }   
  62.    }   
  63.  

Answers (1)