public async Task <ActionResult> Manage(ProposalViewModel model) { try { if (ModelState.IsValid) { #region String Convertion model.Cost = ConvertStringToDecimal(model.SCost); model.NegotiationAllowance = ConvertStringToDecimal(model.SNegotiationAllowance); #endregion await _repo.UpdateProposal(_mapper.Map <Proposal>(model), CurrentUser.Id); if (await _repo.SaveAllAsync()) { TempData["Success"] = string.Format("Proposal has been successfully Updated"); return(RedirectToAction("Manage", new { id = model.Id })); } } foreach (var value in ModelState.Values) { foreach (var error in value.Errors) { TempData["Error"] = error.ErrorMessage; return(RedirectToAction("Manage", new { id = model.Id })); } } return(RedirectToAction("Manage", new { id = model.Id })); } catch (Exception e) { _telemetryClient.TrackException(e); ModelState.AddModelError("error", e.Message); return(ServerError()); } }
//dynamic p = new ExpandoObject(); public IEnumerable <ProposalViewModel> Get(int?lecturerId) { using (var conn = GetConnection()) { //var projects = connection.Query("Select * from Industry_Lecturer_Project Inner Join Project on Industry_Lecturer_Project.project_id = Project.project_id where lecturer_id = @lecturerId", new { lecturerId }); var projects = conn.Query("Select * from Industry_Lecturer_Project Inner Join Project on Industry_Lecturer_Project.project_id = Project.project_id"); List <ProposalViewModel> proposalItems = new List <ProposalViewModel>(); foreach (var i in projects) { ProposalViewModel p = new ProposalViewModel(); p.Id = i.project_id; p.Title = i.project_title; p.Aims = i.project_aims; p.Objectives = i.project_objectives; p.Deadline = i.deadline.ToString("dd/MM/yyyy"); p.TargetAudience = i.target_audience; p.Schedule = i.project_milestones; p.MainFunction = i.main_functions_and_deliverables; p.HardwareAndSoftwareConfiguration = i.hardware_and_software_requirements; p.CompanyName = i.company_name; p.Address = i.company_postal_address; p.Tel = i.company_telephone_number; p.Fax = i.company_fax_number; p.Email = i.company_email_address; p.LiaisonOfficer = i.company_liaison_officer_name; p.WillingToSponsor = i.company_sponsorship_willingness; p.Availability = i.project_availability; proposalItems.Add(p); } return(proposalItems); } }
// // GET: /Car/ public ActionResult Index(ProposalViewModel pvm) { CarBusiness car = new CarBusiness(); pvm.Cars = car.FindAll(); return(View(pvm)); }
public void AddProposal(ProposalViewModel proposal) { using (var conn = GetConnection()) { conn.Execute("insert into Industry_Lecturer_Project(company_name, company_postal_address, company_telephone_number, company_email_address) values(@CompanyName, @Address, @Tel, @Email)", proposal); } }
public ActionResult Save(ProposalViewModel obj) { try { ATMStagsReference.ATMStagsSoapClient atmStags = new ATMStagsReference.ATMStagsSoapClient(); ProposalBusiness proposalBusiness = new ProposalBusiness(); Proposal proposal = new Proposal(); proposal.Insured = new Insured(); proposal.Insured.FirstName = obj.FirstName; proposal.Insured.LastName = obj.LastName; proposal.Insured.Age = obj.Age; CarBusiness carBusiness = new CarBusiness(); proposal.Car = carBusiness.Find(obj.CarId); InsuredBusiness insuredBusiness = new InsuredBusiness(); insuredBusiness.Insert(proposal.Insured); proposalBusiness.Insert(proposal); atmStags.Debitar(300, 2); } catch (Exception ex) { } return(RedirectToAction("List", "Proposal")); }
public IActionResult Submit(ProposalViewModel model) { if (ModelState.IsValid) { try { model.Success = ModelState.IsValid; var item = new ProposalModel { ConferenceName = model.ConferenceName, EndDate = model.EndDate, Region = model.Region, Website = model.Website, CreatedOn = DateTime.UtcNow }; m_worker.AddProposal(item); } catch (Exception ex) { model.Success = false; m_telemetry.TrackException(ex); } } model.Empty = false; model.Region = string.Concat(model.Region, " selected"); return(View("Index", model)); }
public IActionResult Index() { var emptyModel = new ProposalViewModel { Empty = true }; return(View(emptyModel)); }
public IActionResult Proposal() { string QRFID = Request.Query["QRFId"]; bool GetStatus = false; ProposalViewModel model = new ProposalViewModel(); model.MenuViewModel.QRFID = QRFID; model.MenuViewModel.MenuName = "Proposal"; model.CurrentDate = DateTime.Now.ToString("dd MMM yyyy"); string username = ""; username = HttpContext.Request.Cookies["UserName"] ?? ckUserName; model.UserName = username; #region Get Costing Officer Tour Info Header By QRFId NewQuoteViewModel modelQuote = new NewQuoteViewModel(); modelQuote.QRFID = QRFID; model.COHeaderViewModel = cOCommonLibrary.GetCOTourInfoHeader(ref modelQuote, token); model.MenuViewModel.EnquiryPipeline = modelQuote.mdlMenuViewModel.EnquiryPipeline; #endregion ProposalLibrary proposalLibrary = new ProposalLibrary(_configuration); CompanyOfficerGetRes officerGetRes = new CompanyOfficerGetRes(); CompanyOfficerGetReq officerGetReq = new CompanyOfficerGetReq(); officerGetReq.CompanyId = ckUserCompanyId; officerGetReq.UserRole = "Product Accountant"; officerGetRes = agentProviders.GetCompanyOfficers(officerGetReq, token).Result; model.OfficerList = officerGetRes.ContactDetails; var salespipelineres = agentProviders.GetAutomatedSalesPipelineRoles(new SettingsAutomatedGetReq { CompanyId = ckUserCompanyId, QRFId = QRFID, UserRole = officerGetReq.UserRole }, token).Result; if (!string.IsNullOrEmpty(salespipelineres?.ResponseStatus?.Status)) { model.Officer = salespipelineres.UserEmailId; } #region PriceBreakUp if (!string.IsNullOrEmpty(QRFID)) { model.QRFID = QRFID; GetStatus = proposalLibrary.GetProposalPriceBreakupByQRFId(_configuration, token, ref model, QRFID); } ProposalGetReq request = new ProposalGetReq(); ProposalGetRes response = new ProposalGetRes(); request.QRFID = QRFID; response = coProviders.GetProposal(request, token).Result; if (response != null) { model.ProposalId = response.Proposal.ProposalId; model.ProposalPriceBreakupViewModel.PriceBreakUp = response.Proposal.PriceBreakup; } #endregion return(View(model)); }
// GET: Customers public async Task <IActionResult> Index() { UserViewModel userViewModel = new UserViewModel(); string userId = User.GetUserId(); var customer = await _context.Customer .FirstOrDefaultAsync(m => m.customerId == userId); var address = await _context.Address .FirstOrDefaultAsync(m => m.userId == userId); var user = await _context.Users .FirstOrDefaultAsync(m => m.Id == userId); var job = _context.Job.Where(m => m.customerId == userId); FreelancerViewModel freelancer = new FreelancerViewModel(); List <ProposalViewModel> proposals = new List <ProposalViewModel>(); ProposalViewModel proposal = new ProposalViewModel(); foreach (var item in job) { var prop = _context.Proposal.Where(m => m.jobId == item.jobId); if (prop != null) { foreach (var i in prop) { var userr = _context.Users.FirstOrDefault(m => m.Id == i.freelancerId); var freelancer1 = _context.Freelancer.FirstOrDefault(m => m.freelancerId == i.freelancerId); freelancer.freelancerId = item.freelancerId; freelancer.firstName = userr.firstName; freelancer.lastName = userr.lastName; freelancer.email = userr.Email; freelancer.phoneNumber = freelancer1.phoneNumber; freelancer.title = freelancer.category; proposal.freelancer = freelancer; proposal.job = item; proposal.freelancerId = item.freelancerId; proposal.bidAmount = i.bidAmount; proposal.description = i.description; proposal.answers = i.answers; proposals.Add(proposal); } } } CustomerViewModel model = new CustomerViewModel(); model.customerId = customer.customerId; model.phoneNumber = customer.phoneNumber; model.lastName = user.lastName; model.firstName = user.firstName; model.photo = customer.photo; userViewModel.customerViewModel = model; userViewModel.jobs = _context.Job.Where(e => e.customerId.Contains(userId)).ToList(); userViewModel.proposals = proposals; return(View(userViewModel)); }
private async Task SetListItemsAsync(ProposalViewModel model) { ViewBag.CRMs = ViewBag.CRMs ?? await GetCRMsAsync(model.CRMId); ViewBag.BDs = ViewBag.BDs ?? await GetBDUsersAsync(model.BDId); ViewBag.TSs = ViewBag.TSs ?? await GetTSUsersAsync(model.TSId); ViewBag.THs = ViewBag.THs ?? await GetTHUsersAsync(model.THId); }
public async Task AddAsync(ProposalViewModel model) { await this.proposalRepository.AddAsync(new Request() { JobId = model.JobId, FreelancerId = model.FreelancerId, RequestDescription = model.RequestDescription, Offer = model.Offer, HowManyDay = model.HowManyDay }); }
private void FillProposalInfo() { int proposalId = QS("proposalId", 0); ProposalViewModel model = proposalApp.GetProposalViewModel(proposalId); this.lblCompany.Text = model.CompanyName; this.lblProject.Text = model.ProjectTitle; this.lblProposal.Text = model.ProposalTitle; this.lblPO.Text = model.PONo; }
public async Task <IActionResult> PostAsync(ProposalViewModel model) { string res = User.Claims.First(x => x.Type == "FreelancerId").Value; int freelancerId = int.Parse(res); model.FreelancerId = freelancerId; await proposalService.AddAsync(model); return(Ok()); }
public async Task <IActionResult> Propose(int id, string proposeeid) { ProposalViewModel model = new ProposalViewModel(); var currentUser = await GetCurrentUserAsync(); model.ProposeeItem = await _context.InventoryItems.FindAsync(id); model.Proposee = await _context.Users.Include(x => x.Inventory).ThenInclude(x => x.InventoryItems).FirstAsync(x => x.Id == proposeeid); model.Proposer = await _context.Users.Include(x => x.Inventory).ThenInclude(x => x.InventoryItems).FirstAsync(x => x.UserName == User.Identity.Name); return(View(model)); }
// GET: Freelancers public async Task <IActionResult> Index() { UserViewModel userViewModel = new UserViewModel(); string userId = User.GetUserId(); var freelancer = await _context.Freelancer .FirstOrDefaultAsync(m => m.freelancerId == userId); var address = await _context.Address .FirstOrDefaultAsync(m => m.userId == userId); var expertise = await _context.Expertise .FirstOrDefaultAsync(m => m.freelancerId == userId); var user = await _context.Users .FirstOrDefaultAsync(m => m.Id == userId); var job = _context.Job; FreelancerViewModel model = new FreelancerViewModel(); var proposal = _context.Proposal.Where(m => m.freelancerId == userId); List <ProposalViewModel> proposals = new List <ProposalViewModel>(); ProposalViewModel prop = new ProposalViewModel(); foreach (var item in proposal) { prop.jobId = item.jobId; prop.description = item.description; prop.answers = item.answers; prop.bidAmount = item.bidAmount; prop.jobTitle = _context.Job.FirstOrDefault(m => m.jobId == item.jobId).title; proposals.Add(prop); } model.freelancerId = freelancer.freelancerId; model.phoneNumber = freelancer.phoneNumber; model.title = freelancer.title; model.rate = freelancer.rate; model.score = freelancer.score; model.lastName = user.lastName; model.firstName = user.firstName; model.region = address.region; model.city = address.city; model.expertiseStatus = "Unverified"; model.professionalOverview = freelancer.professionalOverview; model.hourlyRate = freelancer.hourlyRate; model.photo = freelancer.photo; model.houseNumber = address.houseNumber; userViewModel.FreelancerViewModel = model; userViewModel.jobs = job.ToList(); userViewModel.proposals = proposals; return(View(userViewModel)); }
public ActionResult Create(ProposalViewModel proposal) { Lecturer lecturer = _lecturerctx.GetLecturer(User.Identity.Name.ToString().Substring(1, User.Identity.Name.Length - 1)); if (ModelState.IsValid) { proposal.SubmittedDate = DateTime.Now; _proposalctx.AddProposal(proposal, lecturer.lecturer_id, lecturer.course_id); _proposalctx.ApproveProposal(proposal.Id); return(RedirectToAction("Index")); } return(View("~/Views/_Lecturer/Proposal/Create.cshtml", proposal)); }
public IActionResult CostingOfficerHeader() { string QRFID = Request.Query["QRFId"]; ProposalViewModel model = new ProposalViewModel(); #region Get Costing Officer Tour Info Header By QRFId NewQuoteViewModel modelQuote = new NewQuoteViewModel(); modelQuote.QRFID = QRFID; model.COHeaderViewModel = cOCommonLibrary.GetCOTourInfoHeader(ref modelQuote, token); ViewData.Add("EnquiryPipeline", modelQuote.mdlMenuViewModel.EnquiryPipeline); #endregion return(PartialView("_CostingOfficerHeader", model.COHeaderViewModel)); }
public async Task <ActionResult> Create(ProposalViewModel model) { if (model.CRMId != 0) { var proposal = await _repo.AddPorposalAsync(_mapper.Map <Proposal>(model), CurrentUser.Id); if (await _repo.SaveAllAsync()) { TempData["Success"] = string.Format("Proposal has been successfully Created"); return(RedirectToAction("Manage", new { @id = proposal.Id })); } TempData["Error"] = "Unable to create Proposal due to some internal issues."; } return(RedirectToAction("Index")); }
public void AddProposal(ProposalViewModel proposal, int lecturerId, int courseId) { using (var connection = GetConnection()) { var p = new DynamicParameters(); p.Add("@inLecturerId", lecturerId, dbType: DbType.Int32); p.Add("@inCourseId", courseId, dbType: DbType.Int32); p.Add("@inCompanyName", proposal.CompanyName, dbType: DbType.String, size: 50); p.Add("@inEmail", proposal.Email, dbType: DbType.String, size: 50); p.Add("@inAddress", proposal.Address, dbType: DbType.String, size: 100); p.Add("@inTel", proposal.Tel, dbType: DbType.StringFixedLength, size: 8); p.Add("@inFax", proposal.Fax, dbType: DbType.StringFixedLength, size: 8); p.Add("@inLiaisonOfficer", proposal.LiaisonOfficer, dbType: DbType.String, size: 50); p.Add("@inWillingToSponsor", proposal.WillingToSponsor, dbType: DbType.Boolean); p.Add("@inProjectTitle", proposal.Title, dbType: DbType.String, size: 50); p.Add("@inProjectAims", proposal.Aims, dbType: DbType.String, size: 500); p.Add("@inProjectObjectives", proposal.Objectives, dbType: DbType.String, size: 500); p.Add("@inTargetAudience", proposal.TargetAudience, dbType: DbType.String, size: 500); p.Add("@inMainFunction", proposal.MainFunction, dbType: DbType.String, size: 500); p.Add("@inHardwareAndSoftwareRequirements", proposal.HardwareAndSoftwareConfiguration, dbType: DbType.String, size: 500); p.Add("@inDeadline", DateTime.Parse(proposal.Schedule).AddMonths(3).ToString(), dbType: DbType.String, size: 500); p.Add("@inSchedule", proposal.Schedule, dbType: DbType.String, size: 500); DateTime dt = DateTime.Now; string r = proposal.ReadyForApproval.ToSelectList().SelectedValue.ToString(); switch (r) { case "0": dt = dt.AddDays(3); break; case "1": dt = dt.AddDays(7); break; case "2": dt = dt.AddDays(10); break; } p.Add("@inDeadline", dt, dbType: DbType.DateTime); p.Add("@inSubmittedOn", proposal.SubmittedDate, dbType: DbType.DateTime); connection.Execute("usp_addExternalProject", p, commandType: CommandType.StoredProcedure); } }
public ActionResult Edit(ProposalViewModel proposal) { if (ModelState.IsValid) { if (User.IsInRole("Admin")) { _proposalctx.ApproveProposal(proposal.Id); } if (User.IsInRole("Manager")) { proposal.SubmittedDate = DateTime.Now; _proposalctx.UpdateProposal(proposal); } return(RedirectToAction("Details", new { proposal.Id })); } return(View(proposal)); }
public async Task <IActionResult> Create(ProposalViewModel ProposalsVM) { if (ModelState.IsValid) { var Proposals = mapper.Map <Proposal>(ProposalsVM); try { await proposalService.InsertAsync(Proposals); } catch (Exception ex) { ModelState.AddModelError("Exception", "Kayıt işlemi sırasında beklenmeyen bir hata oluştu; durumu sistem yöneticisine bildiriniz."); return(View(ProposalsVM)); } return(RedirectToAction("Index")); } return(View(ProposalsVM)); }
async Task Update(ProposalViewModel model) { try { #region String Convertion model.Cost = ConvertStringToDecimal(model.SCost); model.NegotiationAllowance = ConvertStringToDecimal(model.SNegotiationAllowance); #endregion await _repo.UpdateProposal(_mapper.Map <Proposal>(model), CurrentUser.Id); await _repo.SaveAllAsync(); } catch (Exception e) { _telemetryClient.TrackException(e); ModelState.AddModelError("error", e.Message); } }
public async Task <IActionResult> Edit(ProposalViewModel ProposalsVM) { if (ModelState.IsValid) { var Proposals = await proposalService.GetAsync(ProposalsVM.Id); mapper.Map(ProposalsVM, Proposals, typeof(ProposalViewModel), typeof(Proposal)); try { await proposalService.UpdateAsync(Proposals); } catch (Exception ex) { ModelState.AddModelError("Exception", "Kayıt işlemi sırasında beklenmeyen bir hata oluştu; durumu sistem yöneticisine bildiriniz."); return(View(ProposalsVM)); } return(RedirectToAction("Index")); } return(View(ProposalsVM)); }
public ProposalViewModel GetProposalViewModel(int proposalId) { StringBuilder sqlStr = new StringBuilder(); sqlStr.Append("SELECT "); sqlStr.Append("PT.ProposalTrackerID ProposalId ,"); sqlStr.Append("PT.Title ProposalTitle ,"); sqlStr.Append("PT.PONo PONo ,"); sqlStr.Append("P.ProjectID ProjectId ,"); sqlStr.Append("P.Title ProjectTitle ,"); sqlStr.Append("C.ComID CompanyId ,"); sqlStr.Append("C.CompanyName CompanyName "); sqlStr.Append("FROM "); sqlStr.Append("dbo.ProposalTracker AS PT "); sqlStr.Append("LEFT JOIN dbo.Projects AS P ON PT.ProjectID = P.ProjectID "); sqlStr.Append("LEFT JOIN dbo.Companys AS C ON P.CompanyID = C.ComID "); sqlStr.Append("WHERE "); sqlStr.AppendFormat("PT.ProposalTrackerID = {0} ", proposalId); ProposalViewModel model = new ProposalViewModel(); Database db = DatabaseFactory.CreateDatabase(); using (DbCommand dbCommand = db.GetSqlStringCommand(sqlStr.ToString())) { try { using (IDataReader dataReader = db.ExecuteReader(dbCommand)) while (dataReader.Read()) { model = ProposalViewModel.ReaderBind(dataReader); } } catch (Exception ex) { WebLogAgent.Write(string.Format("[SQLText:{0},Messages:\r\n{1}]" , sqlStr.ToString(), ex.Message)); return(null); } } return(model); }
public IActionResult Proposal(string QRFID) { ProposalViewModel model = new ProposalViewModel(); model.MenuViewModel.QRFID = QRFID; model.MenuViewModel.MenuName = "Proposal"; bool GetStatus = false; #region Get Costing Officer Tour Info Header By QRFId NewQuoteViewModel modelQuote = new NewQuoteViewModel(); modelQuote.QRFID = QRFID; model.COHeaderViewModel = cOCommonLibrary.GetCOTourInfoHeader(ref modelQuote, token); model.MenuViewModel.EnquiryPipeline = modelQuote.mdlMenuViewModel.EnquiryPipeline; model.AgentApprovalHeaderButtons = new AgentApprovalHeaderButtons(); model.AgentApprovalHeaderButtons.QRFID = QRFID; model.AgentApprovalHeaderButtons.QRFPriceID = model.COHeaderViewModel.QRFPriceID; #endregion ProposalLibrary proposalLibrary = new ProposalLibrary(_configuration); #region PriceBreakUp if (!string.IsNullOrEmpty(QRFID)) { model.QRFID = QRFID; GetStatus = proposalLibrary.GetProposalPriceBreakupByQRFId(_configuration, token, ref model, QRFID); } ProposalGetReq request = new ProposalGetReq(); ProposalGetRes response = new ProposalGetRes(); request.QRFID = QRFID; response = coProviders.GetProposal(request, token).Result; if (response != null) { model.ProposalId = response.Proposal.ProposalId; model.ProposalPriceBreakupViewModel.PriceBreakUp = response.Proposal.PriceBreakup; } #endregion return(View("Proposal/Proposal", model)); }
public IActionResult ProposalPriceBreakup(string QRFID) { ProposalViewModel model = new ProposalViewModel(); ProposalLibrary proposalLibrary = new ProposalLibrary(_configuration); #region Get Proposal Details by QRFId //proposalGetReq = new ProposalGetReq(); //proposalGetReq.QRFID = QRFID; //proposalGetRes = coProviders.GetProposal(proposalGetReq, token).Result; //model.PriceBreakUp = proposalGetRes.Proposal.PriceBreakup; if (!string.IsNullOrEmpty(QRFID)) { bool GetStatus = false; model.QRFID = QRFID; GetStatus = proposalLibrary.GetProposalPriceBreakupByQRFId(_configuration, token, ref model, QRFID); } #endregion return(PartialView("_ProposalPriceBreakup", model.ProposalPriceBreakupViewModel)); }
public ActionResult Proposal(string idAudienceChannel) { TempData["idAudienceChannel"] = idAudienceChannel; var audienceChannel = audienceChannelManager.GetAudienceChannelById(idAudienceChannel); var audience = audienceManager.GetAudienceById(audienceChannel.AudienceId); var imageProviderCss = audienceChannelManager.GetProviderImageCss(audienceChannel.ProductProviderId); var proposal = ExistProposal(idAudienceChannel); bool existProposal = proposal != null && !string.IsNullOrEmpty(proposal.Id) && proposal.Questions.Any(); ViewBag.existProposal = existProposal; ProposalViewModel viewModel = new ProposalViewModel() { audienceChannel = audienceChannel, audience = audience, providerImageClass = imageProviderCss, listQuestion = existProposal ? ParseExistProposalQuestions(proposal.Questions) : ParseProposalQuestions(audienceChannelManager.GetQuestions(audienceChannel.Id)), proposal = existProposal ? proposal : new ProposalDocument() }; return(View(viewModel)); }
public IActionResult SetSuggestedItinerary(ProposalViewModel model) { string UserName = HttpContext.Request.Cookies["UserName"] ?? ckUserName; model.Itinerary.EditUser = ckUserEmailId; ItinerarySetRes response = new ItinerarySetRes(); ItinerarySetReq request = new ItinerarySetReq(); request.itinerary = model.Itinerary; request.IsNewVersion = model.IsNewVersion; request.itinerary.EditUser = UserName; response = coProviders.SetItinerary(request, token).Result; if (response.ResponseStatus.Status.ToLower() == "success") { return(Json(new { responseText = "success" })); } else { return(Content("Error")); } }
public ActionResult Edit([Bind(Include = "Id,Title,Action")] ProposalViewModel draft) { if (ModelState.IsValid) { switch (draft.Action) { case "Save": _proposalService.SaveDraft(new ProposalDraft { ProposalId = draft.Id, Title = draft.Title }); break; case "Reject": _proposalService.Reject(draft.Id); break; case "Cancel": _proposalService.Cancel(draft.Id); break; case "Request/Publish": _proposalService.RequestPublish(draft.Id); break; case "Request/End": _proposalService.RequestEnd(draft.Id); break; case "Approve": _proposalService.Approval(draft.Id); break; } return(RedirectToAction("Index")); } return(View(draft)); }
public dynamic GetProposalById(int Id) { using (var connection = GetConnection()) { var i = connection.Query("Select * from Industry_Lecturer_Project Inner Join Project on Industry_Lecturer_Project.project_id = Project.project_id where Project.project_id = @Id", new { Id }).SingleOrDefault(); if (i != null) { ProposalViewModel p = new ProposalViewModel(); p.Id = i.project_id; p.LecturerId = i.lecturer_id; p.Title = i.project_title; p.Aims = i.project_aims; p.Objectives = i.project_objectives; p.Deadline = i.deadline.ToString("dd/MM/yyyy"); p.TargetAudience = i.target_audience; p.MainFunction = i.main_functions_and_deliverables; p.HardwareAndSoftwareConfiguration = i.hardware_and_software_requirements; p.Schedule = i.project_milestones; p.CompanyName = i.company_name; p.Address = i.company_postal_address; p.Tel = i.company_telephone_number; p.Fax = i.company_fax_number; p.Email = i.company_email_address; p.LiaisonOfficer = i.company_liaison_officer_name; p.WillingToSponsor = i.company_sponsorship_willingness; p.SubmittedDate = i.submitted_on; p.Availability = i.project_availability; p.ProjectType = "External"; return(p); } else { ProjectRepository projectRepository = new ProjectRepository(); InitiatedProjectViewModel p = projectRepository.GetProject(Id); p.ProjectType = "Student"; return(p); } } }