public ActionResult Index(ConsignmentModel model) { ConsignmentService objService = new ConsignmentService(); int uid = 0; if (Session["UserId"] != null) { uid = Convert.ToInt32(Session["UserId"].ToString()); int cid = 0; if (Session["CompID"] != null) { cid = Convert.ToInt32(Session["CompID"].ToString()); } if (model.CompID == null) { model.CompID = cid; } model.InvoiceNo = "GR"; model.CreatedBy = uid; model.CreatedDate = System.DateTime.Now; model.Status = true; objService.Insert(model); } return(RedirectToAction("Index", new { @menuId = model.Viewbagidformenu })); }
public void ConsignmentByIdTest() { //Arrange var consignmentID = string.Empty; using (IDataContextAsync context = new PAndIContext()) using (IUnitOfWorkAsync unitOfWork = new UnitOfWork(context)) { IRepositoryAsync <Consignment> consignmentRepository = new Repository <Consignment>(context, unitOfWork); IConsignmentService consignmentService = new ConsignmentService(consignmentRepository); var consignment = CreateConsignment(); consignmentID = consignment.ConsignmentID.ToString(); consignmentService.Insert(consignment); unitOfWork.SaveChanges(); } }