public ActionResult book_return(int id, string userid, string username, string sl, string bname, string bdate, string rdate, string ratdate, string fine) { if (!String.IsNullOrEmpty(userid) && !String.IsNullOrEmpty(username)) { var b = service.GetAll().Where(d => d.serialno == sl && d.book_name == bname).FirstOrDefault(); Ibookreturnservice brservice = servicefactory.getbookreturnservice(); bookreturn br = new bookreturn(); br.userid = Convert.ToInt32(userid); br.username = username; br.serialno = sl; br.book_name = bname; br.borrow_date = bdate; br.return_date = rdate; br.return_at = ratdate; br.fine = Convert.ToInt32(fine); brservice.insert(br); b.amount = b.amount + 1; service.update(b); bservice.delete(id); ViewBag.msg = "Return successfully done...!!!"; return(View(br)); } else { bookreturn br = new bookreturn(); ViewBag.msg = "Something wrong...!!!"; return(View(br)); } }
public int delete(int id) { bookreturn a = this.context.bookreturns.SingleOrDefault(c => c.userid == id); context.bookreturns.Remove(a); return(this.context.SaveChanges()); }
public int insert(bookreturn b) { return(this.data.insert(b)); }
public int insert(bookreturn b) { this.context.bookreturns.Add(b); return(this.context.SaveChanges()); }