Ejemplo n.º 1
0
 // PUT: api/DriversLicence/5
 public void Put(int id, [FromBody] DriversLicence model)
 {
     DriversLicenceProcessor.UpdateDriversLicence(model.Id, model.FirstName, model.LastName, model.MiddleName, model.LicenceNumber,
                                                  model.LicenceClass, model.StreetAddress, model.City, model.Province, model.PostalCode, model.Sex, model.EyeColour,
                                                  model.HairColour, model.DobDay, model.DobMonth, model.DobYear, model.Height, model.Weight, model.ExpiryDay, model.ExpiryMonth,
                                                  model.ExpiryYear);
 }
        public void SaveButton(string firstName, string middleName, string lastName, string licenceNumber, int licenceClass, string expiryDate, string streetAddress, string city,
                               string province, string postalCode, string sex, string eyeColour, string hairColour, string dob, int height, int weight)
        {
            // get Id
            int id = SelectedDriversLicence.Id;

            // get expiryDate parts
            String[] dobParts = dob.Split('/');
            int      dobDay   = Int32.Parse(dobParts[0]);
            int      dobMonth = Int32.Parse(dobParts[1]);
            int      dobYear  = Int32.Parse(dobParts[2]);

            // get DOB parts
            String[] expiryDateParts = expiryDate.Split('/');
            int      expiryDay       = Int32.Parse(expiryDateParts[0]);
            int      expiryMonth     = Int32.Parse(expiryDateParts[1]);
            int      expiryYear      = Int32.Parse(expiryDateParts[2]);

            DriversLicenceProcessor.UpdateDriversLicence(id, firstName, lastName, middleName, licenceNumber, licenceClass, streetAddress, city, province, postalCode, sex,
                                                         eyeColour, hairColour, dobDay, dobMonth, dobYear, height, weight, expiryDay, expiryMonth, expiryYear);


            // reset
            FirstName     = "";
            MiddleName    = "";
            LastName      = "";
            LicenceNumber = "";
            LicenceClass  = 0;
            ExpiryDate    = "";
            StreetAddress = "";
            City          = "";
            Province      = "";
            PostalCode    = "";
            Sex           = "";
            EyeColour     = "";
            HairColour    = "";
            Dob           = "";
            Height        = 0;
            Weight        = 0;
        }