public int Post(loginModel loginModel) { int id; try { loginDB loginEF = new loginDB() { userName = loginModel.userName, pswrd = loginModel.password, }; // will save data here in database; using (BGEnqiryEntities context = new BGEnqiryEntities()) { //context.homes.Add(loginEF); context.loginDBs.Add(loginEF); context.SaveChanges(); id = loginEF.id; } return(id); } catch (Exception ex) { return(-1); } }
//public IEnumerable<Register> Get() //{ // List<Register> regList; // using (var context = new RegistrationDBEntities()) // { // regList = context.Registers.ToList(); /* * * */ // } // return regList; //} public string Post(HomeModel homeModel) { int id; try { home hmeEF = new home() { firstName = homeModel.firstName, Mobile = homeModel.mobile, Remarks = homeModel.remarks, Email = homeModel.email, locDubaiBusines = homeModel.locDubaiBusiness, locDubaiSilicon = homeModel.locDubaiSilicon, Budget400K700K = homeModel.budget400K700K, Budget700K1000K = homeModel.budget700K1000K, Budget1000K1250K = homeModel.budget1000K1250K, Budget1250K1500K = homeModel.budget1250K1500K, Studio = homeModel.studio, OneBed = homeModel.oneBed, TwoBed = homeModel.twoBed, Retail = homeModel.retail, Immed = homeModel.immed, Months3to6 = homeModel.months3to6, Months6to12 = homeModel.months6to12, Months12to18 = homeModel.months12to18 }; // will save data here in database; using (BGEnqiryEntities context = new BGEnqiryEntities()) { context.homes.Add(hmeEF); context.SaveChanges(); id = hmeEF.Id; } return("Your Reference Number is: " + id); } catch (Exception ex) { return("Error " + -1 + ex.Message); } }