public async Task <IActionResult> EditUser(int id, [Bind("Id,Login,Email,Password,Moderator,Admin")] User user, int faculty, int univer) { if (id != user.Id) { return(NotFound()); } user.UniversId = univer; user.FacultiesId = faculty; if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(RedirectToAction(nameof(Index))); } ViewData["FacultiesId"] = new SelectList(_context.Faculties, "Id", "Id", user.FacultiesId); ViewData["UniversId"] = new SelectList(_context.Univers, "Id", "Id", user.UniversId); return(View(user)); }
public async Task <IActionResult> Putparkingslot(int id, [FromBody] parkingslot parkingslot) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != parkingslot.sl) { return(BadRequest("Id is not valid")); } db.Entry(parkingslot).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!parkingslotExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task <IActionResult> PutDashboard([FromRoute] int id, [FromBody] Dashboard dashboard) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != dashboard.Id) { return(BadRequest()); } _context.Entry(dashboard).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DashboardExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult> Create([Bind(Include = "CCid,Cid,Oid,Name,Description,ProgramLength,ApplicationFee,TuitionFee,LivingCost,Code,Status")] CollegeCourse collegeCourse, string[] take, Intake section) { using (var transaction = db.Database.BeginTransaction()) { try { collegeCourse.Code = uniquecode(); collegeCourse.Status = true; db.CollegeCourses.Add(collegeCourse); await db.SaveChangesAsync(); // return RedirectToAction("Index"); for (int i = 0; i <= take.Length - 1; i++) { section.CCid = collegeCourse.Code; section.IntakeName = take[i].ToString(); section.Status = true; db.Intakes.Add(section); db.SaveChanges(); } ViewBag.Cid = new SelectList(db.Countries, "Cid", "CountryName", collegeCourse.Cid); ViewBag.Oid = new SelectList(db.Colleges, "Oid", "Name", collegeCourse.Oid); transaction.Commit(); return(RedirectToAction("Index", "CollegeCourses")); } catch (Exception e) { transaction.Rollback(); throw; } } }
public async Task <ActionResult> Create([Bind(Include = "Formid,Preformid,OfferLetterFee,AppliedDate,RecivedDate,ProcessingFee,ProcessAlertDate,CollegeFee,CollegeAlertDate,GICFee,GICAlertDate,EmedicalFee,AppointmentDate,EmbassyFee,EmbassyAlertDate,TrackingId")] ProcessingForm processingForm) { if (ModelState.IsValid) { var pf = db.ProcessingForms.FirstOrDefault(x => x.Formid == processingForm.Formid); if (pf != null) { // ViewBag.message = "Yes"; // this.SetNotification("You Already Filled A Form. You Can Only Edit This Form . Go to Edit page And Edit", NotificationEnumeration.Warning); TempData["Warning"] = "You Already Filled A Form. You Can Only Edit This Form . Go to Edit page And Edit"; return(View(pf)); } else { db.ProcessingForms.Add(processingForm); await db.SaveChangesAsync(); // this.SetNotification("Your File Created Successfully", NotificationEnumeration.Warning); TempData["Sucess"] = "Your File Created Successfully"; return(RedirectToAction("Index")); } } ViewBag.Preformid = new SelectList(db.PreForms, "Preformid", "StudentName", processingForm.Preformid); return(View(processingForm)); }
public async Task <ActionResult> Create([Bind(Include = "Logsid,Date,Time,Templateid,Message,Sender,Preformid")] LogsDetails logsDetails, string message, Helper help, string email) { if (ModelState.IsValid) { logsDetails.Date = System.DateTime.Now.ToShortDateString(); logsDetails.Time = System.DateTime.Now.ToShortTimeString(); logsDetails.Message = message; db.LogsDetails.Add(logsDetails); await db.SaveChangesAsync(); if (email != null) { PreForm stud = db.PreForms.Find(logsDetails.Preformid); Templates tt = db.Templates.Find(logsDetails.Templateid); if (stud.Email != null) { // send logs to client by email string body = help.PopulateBody(stud.StudentName, tt.Title, "", logsDetails.Message); help.SendHtmlFormattedEmail(stud.Email, tt.Template, body); } } return(RedirectToAction("Index")); } ViewBag.Preformid = new SelectList(db.PreForms, "Preformid", "StudentName", logsDetails.Preformid); ViewBag.Templateid = new SelectList(db.Templates, "Templateid", "Title", logsDetails.Templateid); return(View(logsDetails)); }
public async Task <ActionResult> Create([Bind(Include = "Oid,Date,Refusal,RefusalCountry,Name,Mobile,Email,City,Marital,Gender,VisaType,Country,Source,Qualification,PassingYear,Percentage,Paper,TestType,Band,Docs,Passport,inquiryid,franchid,Reading,Listening,Writing,Speaking,RefusalNo,Others,Alternative,type,Sign,passportno")] online online, Helper help) { if (ModelState.IsValid) { online.type = "Offline"; online.Sign = "Action Required"; string franch = help.Permission(); online.franchid = franch; online ol = db.onlines.FirstOrDefault(x => x.franchid == franch); if (ol == null) { online.inquiryid = 1001; } else { var inquiry = db.onlines.Where(x => x.franchid == franch).Max(x => x.inquiryid); online.inquiryid = Convert.ToInt32(inquiry) + 1; } online.Date = System.DateTime.Now; db.onlines.Add(online); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(online)); }
public async Task <IActionResult> AddOrEdit(int id, [Bind("id,name,age,salary,moblie,Date")] employeemodel employeemodel) { if (ModelState.IsValid) { if (id == 0) { employeemodel.Date = DateTime.Now; _context.Add(employeemodel); await _context.SaveChangesAsync(); } else { try { _context.Update(employeemodel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!employeemodelExists(employeemodel.id)) { return(NotFound()); } else { throw; } } } return(Json(new { isValid = true, html = Helper.RenderRazorViewToString(this, "_ViewAll", _context.employee.ToList()) })); } return(Json(new { isValid = false, html = Helper.RenderRazorViewToString(this, "AddOrEdit", employeemodel) })); }
public async Task <ActionResult> Create([Bind(Include = "Preformid,SerialNo,Date,StudentName,FatherName,MotherName,Gender,Address,ContactNo,Email,Nationality,Dateofbirth,Passport,NationalId,Ielts,PrefCountry,PrefCollege,PrefSubject,RefferedName,Comments,Status,Qualification")] PreForm preForm, Helper help) { if (ModelState.IsValid) { var a = db.PreForms.FirstOrDefault(x => x.Email == preForm.Email); if (a == null) { preForm.Status = "Pending"; db.PreForms.Add(preForm); await db.SaveChangesAsync(); if (preForm.Email != null) { var temp = db.Templates.FirstOrDefault(x => x.Templateid == 1); if (temp != null) { string body = help.PopulateBody(preForm.StudentName, "Thanks For Registeration", "", temp.Template); help.SendHtmlFormattedEmail(preForm.Email, temp.Title, body); } } TempData["Sucess"] = "Your Data Submitted Successfully"; return(RedirectToAction("Index")); } else { TempData["Error"] = "Sorry Your Email Id Is already in Used"; // this.SetNotification("Sorry Your Email Id Is already in Used", NotificationEnumeration.Error); return(View()); } } return(View(preForm)); }
public async Task AddViewCout(int productId) { var product = await _dbcontext.Products.FirstOrDefaultAsync(x => x.Id == productId); product.ViewCount++; await _dbcontext.SaveChangesAsync(); }
public async Task <IActionResult> Create([Bind("Id,Title,XAxis,YAxis,Detail,Url")] PieChart pieChart) { if (ModelState.IsValid) { _context.Add(pieChart); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(pieChart)); }
public async Task <ActionResult> Create([Bind(Include = "id,Platform,Icon,Url")] SocialMedia socialMedia) { if (ModelState.IsValid) { db.SocialMedias.Add(socialMedia); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(socialMedia)); }
public async Task <ActionResult> Create([Bind(Include = "Sid,SubmitDate,SubmitBy,FileDoc,ApplicationNo")] SubmitFile submitFile) { if (ModelState.IsValid) { db.SubmitFiles.Add(submitFile); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(submitFile)); }
public async Task <ActionResult> Create([Bind(Include = "id,Name,GstNo,CenterGst,StateGst,TotalGst")] Gst gst) { if (ModelState.IsValid) { db.Gsts.Add(gst); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(gst)); }
public async Task <ActionResult> Create([Bind(Include = "TID,AreaName,Amount")] TransportCharges transportCharges) { if (ModelState.IsValid) { db.TransportCharges.Add(transportCharges); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(transportCharges)); }
public async Task <ActionResult> Create([Bind(Include = "AgentId,AgentName")] Agents agents) { if (ModelState.IsValid) { db.Agents.Add(agents); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(agents)); }
public async Task <ActionResult> Create([Bind(Include = "Infraid,Name,Description,Keyword,MetaDescription")] infrastructureData infrastructureData) { if (ModelState.IsValid) { db.infrastructureDatas.Add(infrastructureData); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(infrastructureData)); }
public async Task <ActionResult> Create([Bind(Include = "CID,ClassName")] SchoolClass schoolClass) { if (ModelState.IsValid) { db.SchoolClasses.Add(schoolClass); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(schoolClass)); }
public async Task <ActionResult> Create([Bind(Include = "Aid,Name,UserName,Password")] Account account) { if (ModelState.IsValid) { db.Accounts.Add(account); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(account)); }
public async Task <ActionResult> Create([Bind(Include = "FeeID,RID,AdmissionFee,TotalFee,TransportFee,AnnualCharges,OtherCharges,Status,Session")] FeeStructure feeStructure) { if (ModelState.IsValid) { db.FeeStructures.Add(feeStructure); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(feeStructure)); }
public async Task <ActionResult> Create([Bind(Include = "Templateid,Title,Template")] Templates templates) { if (ModelState.IsValid) { db.Templates.Add(templates); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(templates)); }
public async Task <ActionResult> Create([Bind(Include = "Countryid,CountryName")] Country country) { if (ModelState.IsValid) { db.Countries.Add(country); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(country)); }
public async Task <ActionResult> Create([Bind(Include = "Gid,Date,ApplicationNo,AccountNo,BankName,Amount,Status,Fundstatus,CreatedBy")] GIC gIC) { if (ModelState.IsValid) { db.Gic.Add(gIC); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(gIC)); }
public async Task <ActionResult> Create([Bind(Include = "CatID,CategoryName")] CatData catData) { if (ModelState.IsValid) { db.CatDatas.Add(catData); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(catData)); }
public async Task <ActionResult> Create([Bind(Include = "Pid,Name")] Publisher publisher) { if (ModelState.IsValid) { db.Publishers.Add(publisher); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(publisher)); }
public async Task <ActionResult> Create([Bind(Include = "Aid,Name,CompanyName,Email,Phone,City,Address,Comission")] Agent agent) { if (ModelState.IsValid) { db.Agents.Add(agent); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(agent)); }
public async Task <ActionResult> Create([Bind(Include = "Pid,Name,Amount")] PaymentStep paymentStep) { if (ModelState.IsValid) { db.PaymentSteps.Add(paymentStep); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(paymentStep)); }
public async Task <ActionResult> Create([Bind(Include = "Sid,Name,Status")] Section section) { if (ModelState.IsValid) { db.Sections.Add(section); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(section)); }
public async Task <ActionResult> Create([Bind(Include = "Depid,name,Description,Keyword,MetaDescription")] departmentdata departmentdata) { if (ModelState.IsValid) { db.departmentdatas.Add(departmentdata); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(departmentdata)); }
public async Task <ActionResult> Create([Bind(Include = "MasterId,Date,BillNo,RID,session,TotalFee,Paid,Discount,Reason,Other,Balance,TimePeriod,status")] MasterFee masterFee) { if (ModelState.IsValid) { db.MasterFees.Add(masterFee); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(masterFee)); }