public async Task <ActionResult <Venture> > PostVenture(Venture venture) { _dbContext.Venture.Add(venture); await _dbContext.SaveChangesAsync(); return(CreatedAtAction("GetVenture", new { key = venture.VentureKey }, venture)); }
public Investment(Investor investor, Venture venture, Amount amount) { this.investor = investor; this.venture = venture; this.Value = amount; this.venture = venture; }
public async Task <IActionResult> PutVenture(Guid key, Venture venture) { if (key != venture.VentureKey) { return(BadRequest()); } _dbContext.Entry(venture).State = EntityState.Modified; try { await _dbContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VentureExists(key)) { return(NotFound()); } else { throw; } } return(NoContent()); }
// GET api/values public IEnumerable <string> Get() { using (var unitOfWork = new UnitOfWork(new PMSContext())) { // Example1 var course = unitOfWork.Ventures.Get(1); // Example2 //var courses = unitOfWork.Courses.GetCoursesWithAuthors(1, 4); // Example3 //var author = unitOfWork.Authors.GetAuthorWithCourses(1); //unitOfWork.Courses.RemoveRange(author.Courses); //unitOfWork.Authors.Remove(author); //unitOfWork.Complete(); var venture = new Venture() { Name = "Insert One", City = "Delhi", IsDeleted = false, Status = "Start", CreatedBy = "KS", CreatedOn = DateTime.UtcNow, Properties = null }; unitOfWork.Ventures.Add(venture); unitOfWork.Complete(); } return(new string[] { "value1", "value2" }); }
public ActionResult DeleteConfirmed(int id) { Venture venture = db.Ventures.Find(id); db.Ventures.Remove(venture); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: Bids/Create public ActionResult Create(int id) { Venture venture = db.Ventures.Find(id); ViewData["ventureID"] = venture.Id; return(View()); }
public ActionResult Edit([Bind(Include = "Id,CompanyName,CompanyDescription,OwnerName,CapitalRaised,Ask,createdOn,Sector,Verified")] Venture venture) { if (ModelState.IsValid) { db.Entry(venture).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(venture)); }
public async Task <PMSResponse <Venture> > GetVenture(VentureRequest ventureRequest) { Venture venture = null; using (var unitOfWork = new UnitOfWork(new PMSContext())) { venture = unitOfWork.Ventures.Get(ventureRequest.VentureId); await unitOfWork.Complete(); } return(ServiceResponse <Venture> .Instance.BuildResponse(ResponseCodes.VentureCreated, venture)); }
public Venture CreateVenture(Language language = null) { var venture = new Venture(); venture.SetCurrentLanguage(language); var descritor = _entityService.GetMultiLingualStringDescriptor(venture.Title.Descriptor.Key); venture.Title.Descriptor.UpdateValue(descritor.Value); return(venture); }
public IActionResult ShowVenture(int ventureId) { User userInDb = LoggedIn(); if (userInDb == null) { return(RedirectToAction("LogOut", "Home")); } Venture show = dbContext.Ventures.Include(v => v.Planner).Include(v => v.GuestList).ThenInclude(r => r.Guest).FirstOrDefault(v => v.VentureId == ventureId); ViewBag.User = userInDb; return(View(show)); }
// GET: Ventures/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Venture venture = db.Ventures.Find(id); if (venture == null) { return(HttpNotFound()); } return(View(venture)); }
public IActionResult DeleteVenture(int ventureId) { User userInDb = LoggedIn(); if (userInDb == null) { return(RedirectToAction("LogOut", "Home")); } Venture remove = dbContext.Ventures.FirstOrDefault(v => v.VentureId == ventureId); dbContext.Ventures.Remove(remove); dbContext.SaveChanges(); return(RedirectToAction("Dashboard")); }
public void storeVentureDataInSession(int ventureID) { DbMethods DbMethods = new DbMethods(); Venture ventureObj = new Venture(); ventureObj = DbMethods.GetVenture(ventureID); //store all wanted skills DataSet allVentureSkills = DbMethods.GetVentureSkills(ventureID); for (int i = 0; i < allVentureSkills.Tables[0].Select().Length; i++) { int SkillID = (int)allVentureSkills.Tables[0].Rows[i][0]; string SkillName = allVentureSkills.Tables[0].Rows[i][1].ToString(); ventureObj.AllVentureSkills.Add(new Tuple <int, string>(SkillID, SkillName)); } //store members and roles DataSet ventureMembersAndRolesDS = DbMethods.GetVentureMembersAndRoles(ventureID); for (int i = 0; i < ventureMembersAndRolesDS.Tables[0].Select().Length; i++) { string role = ventureMembersAndRolesDS.Tables[0].Rows[i][0].ToString(); string firstName = ventureMembersAndRolesDS.Tables[0].Rows[i][1].ToString(); string lastName = ventureMembersAndRolesDS.Tables[0].Rows[i][2].ToString(); string memberName = firstName + " " + lastName; string username = ventureMembersAndRolesDS.Tables[0].Rows[i][3].ToString(); ventureObj.memberNameAndRoleList.Add(new Tuple <string, string, string>(username, memberName, role)); } //store static members and roles DataSet staticMembersAndRolesDS = DbMethods.GetAllStaticMembersByVentureID(ventureID); for (int i = 0; i < staticMembersAndRolesDS.Tables[0].Select().Length; i++) { int StaticMemberID = (int)staticMembersAndRolesDS.Tables[0].Rows[i][0]; string firstName = staticMembersAndRolesDS.Tables[0].Rows[i][1].ToString(); string lastName = staticMembersAndRolesDS.Tables[0].Rows[i][2].ToString(); string role = staticMembersAndRolesDS.Tables[0].Rows[i][3].ToString(); string staticMemberName = firstName + " " + lastName; ventureObj.staticMembersList.Add(new Tuple <string, string, int>(staticMemberName, role, StaticMemberID)); } //store object in session Session["ventureObj"] = ventureObj; }
public ActionResult Create([Bind(Include = "Id,CompanyName,LogoDesign,CompanyDescription,OwnerName,CapitalRaised,Ask,createdOn,Sector,Verified")] Venture venture) { if (ModelState.IsValid) { venture.createdOn = DateTime.Now; ApplicationUser currentUser = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>().FindById(User.Identity.GetUserId()); venture.investorID = currentUser.Id; db.Ventures.Add(venture); db.SaveChanges(); return(RedirectToAction("GridIndex")); } return(View(venture)); }
public void TestMultiLingual() { var venture = new Venture(); var title = "tententen"; venture.SetTitle(title); Assert.True(title.Equals(venture.Title.ToString())); venture.SetCurrentLanguage(SystemLanguages.FrenchSwitzerland); var title1 = "blar blar"; venture.SetTitle(title1); Assert.True(title1.Equals(venture.Title.ToString())); }
public IActionResult CreateVenture(Venture newVent) { User userInDb = LoggedIn(); if (userInDb == null) { return(RedirectToAction("LogOut", "Home")); } if (ModelState.IsValid) { dbContext.Ventures.Add(newVent); dbContext.SaveChanges(); return(Redirect($"/venture/{newVent.VentureId}")); } else { ViewBag.User = userInDb; return(View("NewVenture")); } }
public static DateTime GetWorkTime(DateTime startTime, string ventureId) { WorkCenterCalendar noWorkCalender = SchedulePlan.GetEntity().WorkCenterCalendar.Where(p => DbFunctions.TruncateTime(p.NoWorkBeginDate) <= startTime && DbFunctions.TruncateTime(p.NoWorkEndDate) >= startTime).FirstOrDefault(); DateTime workTime; if (noWorkCalender != null) { workTime = (DateTime)noWorkCalender.NoWorkEndDate; } else { workTime = startTime; } List <Venture_Shift> vfList = SchedulePlan.GetEntity().Venture_Shift.Where(p => p.VentureId == ventureId).ToList(); if (!vfList.Any()) { Venture v = SchedulePlan.GetEntity().Venture.Where(p => p.VentureId == ventureId).FirstOrDefault(); throw new Exception(v.VentureName + "(" + v.VentureId + ")" + "经营体与工厂日历关系未维护!"); } var shiftIdList = vfList.Select(p => p.ShiftId).ToList(); var shiftList = SchedulePlan.GetEntity().Shift.Where(p => shiftIdList.Contains(p.ShiftId)).ToList(); var minTimeFrom = shiftList.Max(p => p.TimeFrom); Shift shift = shiftList.Where(p => p.TimeFrom == minTimeFrom).FirstOrDefault(); if (shift == null) { throw new Exception("工厂日历未维护!"); } string[] minsecond = shift.TimeFrom.Split(new char[] { ':' }); DateTime workStartTime = new DateTime(startTime.Year, startTime.Month, startTime.Day, int.Parse(minsecond[0]), int.Parse(minsecond[1]), 0); DateTime workEndTime = workStartTime.AddMinutes(Convert.ToDouble(shift.TimeRange)); if (workTime < workStartTime || workTime > workEndTime) { workTime = workStartTime.AddDays(1); noWorkCalender = SchedulePlan.GetEntity().WorkCenterCalendar.Where(p => DbFunctions.TruncateTime(p.NoWorkBeginDate) >= workTime || DbFunctions.TruncateTime(p.NoWorkEndDate) <= workTime).FirstOrDefault(); if (noWorkCalender != null) { TimeSpan?ts = noWorkCalender.NoWorkEndDate - noWorkCalender.NoWorkBeginDate; int day = ((TimeSpan)ts).Days; workTime = workStartTime.AddDays(day + 1); } } //return return(workTime); }
public virtual void GiveReturn(Venture venture, Amount dividend) { investor.AcceptReturn(venture, dividend); }