public async Task <IActionResult> Create([Bind("PkJobAttachmentId,FkAttachmentJob,JobAttachmentFilePath,JobAttachmentFileName,JobAttachmentDownloadName")] AttachmentViewModel tblJobAttachment) { if (ModelState.IsValid) { string uniqufilename = null; if (tblJobAttachment.JobAttachmentFilePath != null && tblJobAttachment.JobAttachmentFilePath.Count > 0) { foreach (var attachment in tblJobAttachment.JobAttachmentFilePath) { string filefolder = Path.Combine(_environment.WebRootPath, "Files"); uniqufilename = Guid.NewGuid().ToString() + "_" + attachment.FileName; string filepath = Path.Combine(filefolder, uniqufilename); attachment.CopyTo(new FileStream(filepath, FileMode.Create)); TblJobAttachment jobAttachment = new TblJobAttachment() { FkAttachmentJob = tblJobAttachment.FkAttachmentJob, JobAttachmentDownloadName = tblJobAttachment.JobAttachmentDownloadName, JobAttachmentFileName = tblJobAttachment.JobAttachmentFileName, JobAttachmentFilePath = uniqufilename, }; _context.Add(jobAttachment); } } await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index), "TblJobs")); } ViewData["FkAttachmentJob"] = new SelectList(_context.TblJob, "PkJobId", "JobBudget", tblJobAttachment.FkAttachmentJob); return(View(tblJobAttachment)); }
public async Task <IActionResult> Create([Bind("PkCertificationId,CertificationName,FkCertificationUserId")] CertificateViewModel tblUserCertification) { tblUserCertification.FkCertificationUserId = _usermanager.GetUserId(User); string uniqucertename = null; if (tblUserCertification.CertificationName != null) { string filefolder = Path.Combine(_environment.WebRootPath, "Files"); uniqucertename = Guid.NewGuid().ToString() + "_" + tblUserCertification.CertificationName.FileName; string filepath = Path.Combine(filefolder, uniqucertename); tblUserCertification.CertificationName.CopyTo(new FileStream(filepath, FileMode.Create)); } TblUserCertification newCert = new TblUserCertification() { CertificationName = uniqucertename, FkCertificationUserId = _usermanager.GetUserId(User) }; _context.Add(newCert); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); //} //ViewData["FkCertificationUserId"] = new SelectList(_context.Users, "Id", "Id", tblUserCertification.FkCertificationUserId); return(View(tblUserCertification)); }
public async Task <IActionResult> Create([Bind("PkBidId,FkJobBidded,BidOfferInformation")] TblBid tblBid, string tojob) { //if (ModelState.IsValid) //{ tblBid.BidTime = DateTime.Now.ToString(); tblBid.FkBidUser = _userManager.GetUserId(User); tblBid.BidStatus = "Active"; tblBid.BidAwardTime = ""; _context.Add(tblBid); await _context.SaveChangesAsync(); if (tojob.Length > 0) { return(RedirectToAction("Index", "TblJobs")); } return(RedirectToAction(nameof(Index))); //} // ViewData["FkBidUser"] = new SelectList(_context.Users, "Id", "Id", tblBid.FkBidUser); // ViewData["FkJobBidded"] = new SelectList(_context.TblJob, "PkJobId", "JobBudget", tblBid.FkJobBidded); //if (tojob.Length > 0) //{ // return RedirectToAction("Index", "TblJobs"); //} // return View(tblBid); }
public async Task <IActionResult> Create([Bind("PkWkspcId,FkWkspcBid,WkspcStartTime,WkspcExpectendEndTime")] TblWorkspace tblWorkspace) { var bidupdate = _context.TblBid; var job_edit = _context.TblJob.SingleOrDefault(z => z.PkJobId == bidupdate.SingleOrDefault(x => x.PkBidId == tblWorkspace.FkWkspcBid).FkJobBidded); tblWorkspace.WkspcAmountAgreed = "0"; tblWorkspace.WkspcStatus = "Started"; if (ModelState.IsValid) { var update_bid = bidupdate.SingleOrDefault(x => x.PkBidId == tblWorkspace.FkWkspcBid); _context.Add(tblWorkspace); if (update_bid != null) { update_bid.BidStatus = "Granted"; } if (update_bid != null) { update_bid.BidAwardTime = DateTime.Now.ToString(CultureInfo.InvariantCulture); } if (job_edit != null) { job_edit.JobStatus = "Granted"; } foreach (var deniedbid in bidupdate.Where(x => x.PkBidId != tblWorkspace.FkWkspcBid && x.FkJobBidded == job_edit.PkJobId)) { deniedbid.BidStatus = "Denied"; } await _context.SaveChangesAsync(); /*return RedirectToAction(nameof(Index),new {tblWorkspace.FkWkspcBid});*/ return(RedirectToAction("Bidusers", "TblBids")); } ViewData["FkWkspcBid"] = new SelectList(_context.TblBid, "PkBidId", "BidOfferInformation", tblWorkspace.FkWkspcBid); return(View(tblWorkspace)); }
public async Task <IActionResult> Create([Bind("PkDepositDeductionId,FkDepositDeductionHistory,DepositDeductionDescription,DepositDeductionAmount")] TblDepositDeduction tblDepositDeduction) { if (ModelState.IsValid) { _context.Add(tblDepositDeduction); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FkDepositDeductionHistory"] = new SelectList(_context.TblEmployerDepositHistory, "PkDepositId", "DepositAmount", tblDepositDeduction.FkDepositDeductionHistory); return(View(tblDepositDeduction)); }
public async Task <IActionResult> Create([Bind("PkPayId,FkWorkspacePay,PayDescription,PayAmount,PayBalance,PayDate,PayDeductions,FinalPay")] TblUserPaymentHistory tblUserPaymentHistory) { if (ModelState.IsValid) { _context.Add(tblUserPaymentHistory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FkWorkspacePay"] = new SelectList(_context.TblWorkspace, "PkWkspcId", "WkspcAmountAgreed", tblUserPaymentHistory.FkWorkspacePay); return(View(tblUserPaymentHistory)); }
public async Task <IActionResult> Create([Bind("PkPayDeductionId,FkPayDeductionHistory,PayDeductionDescription,PayDeductionAmount")] TblPaymentDeduction tblPaymentDeduction) { if (ModelState.IsValid) { _context.Add(tblPaymentDeduction); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FkPayDeductionHistory"] = new SelectList(_context.TblUserPaymentHistory, "PkPayId", "FinalPay", tblPaymentDeduction.FkPayDeductionHistory); return(View(tblPaymentDeduction)); }
public async Task <IActionResult> Create([Bind("PkDirectChatId,FkDirectChatEmployer,DirectChatMessage,DirectChatTimeSent,DirectChatSender,DirectChatStatus,DirectChatTimeRead")] TblChatDirect tblChatDirect) { if (ModelState.IsValid) { _context.Add(tblChatDirect); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FkDirectChatEmployer"] = new SelectList(_context.Users, "Id", "Id", tblChatDirect.FkDirectChatEmployer); return(View(tblChatDirect)); }
public async Task <IActionResult> Create([Bind("PkWkspcId,FkWkspcBid,WkspcStartTime,WkspcExpectendEndTime,WkspcActualEndTime,WkspcRating,WkspcStatus,WkspcFeedback,WkspcAmountAgreed")] TblWorkspace tblWorkspace) { if (ModelState.IsValid) { _context.Add(tblWorkspace); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index), new { tblWorkspace.FkWkspcBid })); } ViewData["FkWkspcBid"] = new SelectList(_context.TblBid, "PkBidId", "BidOfferInformation", tblWorkspace.FkWkspcBid); return(View(tblWorkspace)); }
public async Task <IActionResult> Create([Bind("PkJobAttachmentId,FkAttachmentJob,JobAttachmentFilePath,JobAttachmentFileName,JobAttachmentDownloadName")] TblJobAttachment tblJobAttachment) { if (ModelState.IsValid) { _context.Add(tblJobAttachment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FkAttachmentJob"] = new SelectList(_context.TblJob, "PkJobId", "JobBudget", tblJobAttachment.FkAttachmentJob); return(View(tblJobAttachment)); }
public async Task <IActionResult> Create([Bind("PkDisptId,FkDisptWorkspace,DisptReason,DisptStatus,DisptRaiseTime,DisptConclusionTime,DisptOutcome")] TblDispute tblDispute) { if (ModelState.IsValid) { _context.Add(tblDispute); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FkDisptWorkspace"] = new SelectList(_context.TblWorkspace, "PkWkspcId", "WkspcAmountAgreed", tblDispute.FkDisptWorkspace); return(View(tblDispute)); }
public async Task <IActionResult> Create([Bind("PkSkillId,UserSkillName")] TblUserSkill tblUserSkill) { tblUserSkill.FkSkillUserId = _usermanager.GetUserId(User); if (ModelState.IsValid) { _context.Add(tblUserSkill); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FkSkillUserId"] = new SelectList(_context.Users, "Id", "Id", tblUserSkill.FkSkillUserId); return(View(tblUserSkill)); }
public async Task <IActionResult> Create([Bind("PkWkspChatId,FkWkspChatWorkspace,FkWkspChatUser,WkspChatMessage,WkspChatTimeSent,WkspChatSender,WkspChatStatus,WkspChatTimeRead")] TblChatWorkspace tblChatWorkspace) { if (ModelState.IsValid) { _context.Add(tblChatWorkspace); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FkWkspChatUser"] = new SelectList(_context.Users, "Id", "Id", tblChatWorkspace.FkWkspChatUser); ViewData["FkWkspChatWorkspace"] = new SelectList(_context.TblWorkspace, "PkWkspcId", "WkspcAmountAgreed", tblChatWorkspace.FkWkspChatWorkspace); return(View(tblChatWorkspace)); }
public async Task <IActionResult> Create([Bind("PkJobId,JobTitle,JobBudget,JobCategory,JobDuration,JobDescription")] TblJob tblJob) { if (ModelState.IsValid) { tblJob.FkJobEmployer = _userManager.GetUserId(User); tblJob.JobStatus = "Active"; _context.Add(tblJob); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FkJobEmployer"] = new SelectList(_context.Users, "Id", "Id", tblJob.FkJobEmployer); return(View(tblJob)); }
public async Task CreateTicket(TicketModel ticket) { var labels = await GetLabels(dbContext.Labels, ticket.Labels); dbContext.Add(new Ticket() { Title = ticket.Title, CategoryId = ticket.CategoryId, Description = ticket.Description, Labels = labels.ToList() }); await dbContext.SaveChangesAsync(); }
public async Task <IActionResult> Create([Bind("MessageId,reciever_id,message")] Massage massage, string bidpage, int?jbId, string bidstatus) { massage.sender_id = _usermanager.GetUserId(User); massage.created_at = DateTime.Now; if (ModelState.IsValid) { _context.Add(massage); await _context.SaveChangesAsync(); if (!string.IsNullOrEmpty(bidpage)) { RedirectToAction("Bidusers", "TblBids", new { jbId }); } if (jbId != null) { RedirectToAction("Index", "TblBids", new { jbId, bidstatus }); } return(RedirectToAction(nameof(MyMasssages))); } ViewData["reciever_id"] = new SelectList(_context.Users, "Id", "Id", massage.reciever_id); ViewData["sender_id"] = new SelectList(_context.Users, "Id", "Id", massage.sender_id); return(View(massage)); }