public string SendRequest([FromForm] string json) { RequestForm rf = JsonConvert.DeserializeObject <RequestForm>(json); Person p = new Person(); p.FirstName = rf.FirstName; p.LastName = rf.LastName; p.FatherName = rf.FatherName; p.UID = rf.UID; p.Email = rf.Email; WeaponCertificate wc = new WeaponCertificate(); wc.Brand = rf.Brand; wc.RegistrationNumber = rf.RegNum; wc.Type = rf.Type; Request request = new Request(); request.person = p; request.weaponCertificate = wc; AddRequest(request); // proveriti podatke centralnom registru bool res = SendCS(request.person); if (!res) { return("Nije pronadjen u centralnom registru"); } if (!CheckWeaponCerticifate(request.weaponCertificate)) { return("Nisu uneti sve podaci o oruzju"); } /* * if (!request.Paid) * { * // obavesti korisnika * return "Nije placeno"; * }*/ if (ExistsReport(request.person.UID)) { } else { res = ScheduleHealth(request.person); if (!res) { return("Nije zakazan pregled"); } else { return("Pregled je zakazan"); } } WeaponLicence licence = new WeaponLicence(); licence.DateOfIssue = DateTime.Now; licence.ValidUntil = licence.DateOfIssue.AddYears(5); licence.FirstName = request.person.FirstName; licence.LastName = request.person.LastName; licence.RegistrationNumber = ""; RequestProcessed(request); AddWeaponLicence(licence); //obavesti korisnika* return("Uspesno"); }
public void AddWeaponLicence(WeaponLicence wl) { _context.licences.Add(wl); _context.SaveChanges(); }