public async Task <ActionResult <interest> > Postinterest(interest interest) { _context.interests.Add(interest); await _context.SaveChangesAsync(); return(CreatedAtAction("Getinterest", new { id = interest.ID }, interest)); }
public async Task <IActionResult> Putinterest(int id, interest interest) { if (id != interest.ID) { return(BadRequest()); } _context.Entry(interest).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!interestExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult interestAdd(int?job_id) { if (!(Session["userid"] == null && job_id == null)) { int jobseeker_id = Convert.ToInt32(Session["js_id"].ToString()); interest app = new interest(); app.jobseeker_id = jobseeker_id; app.created_at = DateTime.Now; app.job_id = job_id; app.status = 1; int checkExists = (from q in db.interests where q.jobseeker_id == jobseeker_id where q.job_id == job_id where q.status == 1 select q.int_id).Count(); if (checkExists == 0) { db.interests.Add(app); if (db.SaveChanges() > 0) { return(Json(true, JsonRequestBehavior.AllowGet)); } else { return(Json(false, JsonRequestBehavior.AllowGet)); } } else { return(Json(false, JsonRequestBehavior.AllowGet)); } } else { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult DeleteConfirmed(int id) { interest interest = db.interests.Find(id); db.interests.Remove(interest); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,interest1")] interest interest) { if (ModelState.IsValid) { db.Entry(interest).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(interest)); }
public ActionResult Create([Bind(Include = "ID,interest1")] interest interest) { if (ModelState.IsValid) { db.interests.Add(interest); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(interest)); }
// GET: Interests/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } interest interest = db.interests.Find(id); if (interest == null) { return(HttpNotFound()); } return(View(interest)); }
public async Task <ActionResult <interest> > Getinterest(int id, int aId, int cId) { List <interest> interests = await _context.interests.ToListAsync(); interest interest = (interest)interests.Find(p => p.creditId == cId && p.accountId == aId); if (interest == null) { return(NotFound()); } return(interest); /*var interest = await _context.interests.FindAsync(id); * * if (interest == null) * { * return NotFound(); * }*/ }
public string Konut(int id) { HttpResponseMessage response; if (HttpContext.Session.GetString("User") != null) { user user = JsonConvert.DeserializeObject <user>(HttpContext.Session.GetString("User"));//PaHttpContext.Session.GetString("User"); string url = "interests/1?aId=" + user.accountId + "&cId=" + id; response = GlobalVeriables.wepApiClient.GetAsync(url).Result; } else { string url = "interests/1?aId=1&cId=" + id; response = GlobalVeriables.wepApiClient.GetAsync(url).Result; } interest faiz = response.Content.ReadAsAsync <interest>().Result; Faiz.faiz = faiz.value; return(JsonConvert.SerializeObject(faiz)); }
public ActionResult removeInterest(int int_id) { interest sh = db.interests.Find(int_id); if (sh != null) { sh.status = 0; if (db.SaveChanges() > 0) { return(Json(true, JsonRequestBehavior.AllowGet)); } else { return(Json(false, JsonRequestBehavior.AllowGet)); } } else { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public void Post([FromBody] interest value) { double datasalary = value.Salary; double datadok = value.Dok; int datayear = value.Year; for (int i = 1; i <= datayear; i++) { double sum = datasalary * datadok / 100; double total = datasalary + sum; var newproduct = new interest { Salary = datasalary, Dok = datadok, Total = total, Year = i }; dok.Add(newproduct); datasalary = total; } }