public async Task <ActionResult> Edit([Bind(Include = "REGId,Session,Type,AddmissionNumber,RollNumber,CID,SCID,FirstName,LastName,Gender,DOB,CatID,Mobile,Email,AdmissionDate,Image,FatherName,FatherPhone,FatherOccupation,MotherName,MotherPhone,MotherOccupation,CurrentAddress,ParmanentAddress,AadharNumber,TID,SpecialCase,Remarks,AdmissionFee")] Registration registration, HttpPostedFileBase file, Helper Help)
        {
            if (ModelState.IsValid)
            {
                registration.Image = file != null?Help.uploadfile(file) : img;

                #region delete file
                string fullPath = Request.MapPath("UploadedFiles/" + img);
                registration.AdmissionDate = dtadd;
                registration.DOB           = dtdob;
                if (img == registration.Image)
                {
                }
                else
                {
                    if (System.IO.File.Exists(fullPath))
                    {
                        System.IO.File.Delete(fullPath);
                    }
                }
                #endregion
                db.Entry(registration).State = EntityState.Modified;
                await db.SaveChangesAsync();

                TempData["Success"] = "Updated Successfully";
                return(RedirectToAction("Index"));
            }
            ViewBag.CatID = new SelectList(db.CatDatas, "CatID", "CategoryName", registration.CatID);
            ViewBag.CID   = new SelectList(db.SchoolClasses, "CID", "ClassName", registration.CID);
            ViewBag.SCID  = new SelectList(db.Sections, "SCID", "SectionName", registration.SCID);
            ViewBag.TID   = new SelectList(db.TransportCharges, "TID", "AreaName", registration.TID);
            return(View(registration));
        }
        public async Task <ActionResult> Edit([Bind(Include = "Gid,Date,ApplicationNo,AccountNo,BankName,Amount,Status,Fundstatus,CreatedBy,Files,Certificate,Username,Password,SecurityQuestion,Answer,Caq,CaqUser,CaqPassword,EmailId,EmailPassword,ArrimaUser,ArrimaPassword")] GIC gIC, HttpPostedFileBase file, HttpPostedFileBase thumb, HttpPostedFileBase Caq, Helper help)
        {
            if (ModelState.IsValid)
            {
                using (var transaction = db.Database.BeginTransaction())
                {
                    try
                    {
                        if (file == null || thumb == null || Caq == null)
                        {
                            gIC.Files = file != null?help.uploadfile(file) : img;

                            gIC.Certificate = thumb != null?help.uploadfile(thumb) : img;

                            gIC.Caq = Caq != null?help.uploadfile(Caq) : ca;

                            db.Entry(gIC).State = EntityState.Modified;
                            await db.SaveChangesAsync();

                            Application app = db.Applications.FirstOrDefault(x => x.ApplicationNo == gIC.ApplicationNo);
                            TempData["Success"] = "Gic Account Updated Successfully";
                            transaction.Commit();
                            return(RedirectToAction("Create", "Application", new { id = app.InquiryId }));
                        }
                        else if (file.ContentType == "application/pdf")
                        {
                            gIC.Files = file != null?help.uploadfile(file) : img;

                            gIC.Certificate = thumb != null?help.uploadfile(thumb) : img;

                            gIC.Caq = Caq != null?help.uploadfile(Caq) : ca;

                            db.Entry(gIC).State = EntityState.Modified;
                            await db.SaveChangesAsync();

                            Application app = db.Applications.FirstOrDefault(x => x.ApplicationNo == gIC.ApplicationNo);
                            TempData["Success"] = "Gic Account Updated Successfully";
                            transaction.Commit();
                            return(RedirectToAction("Create", "Application", new { id = app.InquiryId }));
                        }
                        else
                        {
                            TempData["danger"] = "upload only pdf file";
                            transaction.Commit();
                            return(RedirectToAction("Edit", "Gics", new { id = gIC.Gid }));
                        }
                    }
                    catch (Exception)
                    {
                        transaction.Rollback();
                        Application app = db.Applications.FirstOrDefault(x => x.ApplicationNo == gIC.ApplicationNo);
                        TempData["danger"] = "Sorry Gic Update Failed";
                        return(RedirectToAction("Create", "Application", new { id = app.InquiryId }));

                        throw;
                    }
                }
            }
            return(View(gIC));
        }
Ejemplo n.º 3
0
        public ActionResult Edit([Bind(Include = "FirstName, LastName, Email")] User user)
        {
            if (Session["Admin"] != null || Session["User"] == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (user.Email == null || user.LastName == null || user.FirstName == null)
            {
                return(View(user));
            }
            log.Info("Edit user " + ((User)Session["User"]).Id);
            var id = ((User)Session["User"]).Id;

            if (!db.Users.Any(x => x.Email == user.Email && x.Id != id))
            {
                user.Id              = ((User)Session["User"]).Id;
                user.TokensNumber    = ((User)Session["User"]).TokensNumber;
                user.Password        = ((User)Session["User"]).Password;
                db.Entry(user).State = EntityState.Modified;
                db.SaveChanges();
                ((User)Session["User"]).FirstName = user.FirstName;
                ((User)Session["User"]).LastName  = user.LastName;
                ((User)Session["User"]).Email     = user.Email;
                return(RedirectToAction("Index", "Manage"));
            }
            else
            {
                ViewBag.Message = "Email has already been taken";
                return(View(user));
            }
        }
        public ActionResult Edit([Bind(Include = "Id,date,inquiryid,name,fname,contact,address,referedby,Categoryid")] tblinquiry tblinquiry, [Bind(Include = "Id,date,inquiryid,feedback,days,type,nexfollow,status,loginid")] tblfeedback tblfeedback)
        {
            if (ModelState.IsValid)
            {
                db.Entry(tblinquiry).State = EntityState.Modified;
                db.SaveChanges();
                DateTime next = new DateTime();
                if (tblfeedback.type == "Days")
                {
                    next = System.DateTime.Now.AddDays(tblfeedback.days);
                }

                else
                {
                    next = System.DateTime.Now;
                }
                tblfeedback.date            = tblinquiry.date;
                tblfeedback.inquiryid       = tblinquiry.inquiryid;
                tblfeedback.loginid         = Session["User"].ToString();
                tblfeedback.nextfollow      = next;
                db.Entry(tblfeedback).State = EntityState.Modified;
                db.SaveChanges();
                TempData["Success"] = "Updated Successfully";
                return(RedirectToAction("Index"));
            }
            return(View(tblinquiry));
        }
Ejemplo n.º 5
0
        // GET: Instructors
        public ActionResult Index(int?id, int?courseID)
        {
            var viewModel = new InstructorIndexData();

            viewModel.Instructors = db.Instructors
                                    .Include(i => i.OfficeAssignment)
                                    .Include(i => i.Courses.Select(c => c.Department))
                                    .OrderBy(i => i.LastName);
            if (id != null)
            {
                ViewBag.InstructorID = id.Value;
                viewModel.Courses    = viewModel.Instructors.Where(
                    i => i.ID == id.Value).Single().Courses;
            }
            if (courseID != null)
            {
                ViewBag.CourseID = id.Value;
                //viewModel.Enrollments = viewModel.Courses.Where(
                //    i => i.CourseID == courseID).Single().Enrollments;
                var selectedCourse = viewModel.Courses.Where(x => x.CourseID == courseID).Single();
                db.Entry(selectedCourse).Collection(x => x.Enrollments).Load();
                foreach (Enrollment enrollment in selectedCourse.Enrollments)
                {
                    db.Entry(enrollment).Reference(x => x.Student).Load();
                }

                viewModel.Enrollments = selectedCourse.Enrollments;
            }
            return(View(viewModel));
        }
Ejemplo n.º 6
0
        public ActionResult Create(int Amount, int Discount, int CourseId, DateTime Alert, DateTime date, Recipt_Details receiptdetail)
        {
            try
            {
                // TODO: Add insert logic here
                Fees_Master feesmaster = db.Fees_Master.FirstOrDefault(x => x.RollNo == rollno);
                feesmaster.discount        = (Convert.ToInt32(feesmaster.discount) + Convert.ToInt32(Discount));
                feesmaster.Date            = date;
                feesmaster.AlertDate       = Alert;
                feesmaster.PaidFees       += Amount;
                feesmaster.Status          = true;
                db.Entry(feesmaster).State = EntityState.Modified;
                db.SaveChanges();

                receiptdetail.RollNo   = rollno;
                receiptdetail.ReciptNo = receiptno;
                receiptdetail.CourseId = CourseId;
                receiptdetail.Date     = date;
                receiptdetail.Amount   = Amount;
                receiptdetail.Active   = true;
                db.Recipt_Details.Add(receiptdetail);
                db.SaveChanges();
                TempData["Success"] = "Saved Successfully";
                return(RedirectToAction("invoice", new { id = receiptno }));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Edit([Bind(Include = "Id,CourseId,Admitdate,enddate,Fees,RoomId,Status,Days,Token")] StudentCourse student_Course)
        {
            if (ModelState.IsValid)
            {
                string a  = help.Permission();
                Course cc = db.Courses.First(x => x.CourseId == student_Course.CourseId && x.franchid == a);
                student_Course.RollNo          = rollno;
                student_Course.Uid             = a;
                student_Course.enddate         = Convert.ToDateTime(student_Course.Admitdate).AddDays(student_Course.Days);
                student_Course.Fees            = (Convert.ToInt32(cc.Fees) * Convert.ToInt32(student_Course.Days)).ToString();
                db.Entry(student_Course).State = EntityState.Modified;
                db.SaveChanges();

                Fees_Master feemaster = db.Fees_Master.FirstOrDefault(x => x.RollNo == rollno && x.franchid == a && x.Token == student_Course.Token && x.Status == true);
                //feemaster.RollNo = student_Course.RollNo;
                feemaster.Date      = System.DateTime.Now;
                feemaster.CourseId  = student_Course.CourseId;
                feemaster.AlertDate = System.DateTime.Now.AddDays(2);
                feemaster.Status    = true;
                feemaster.TotalFees = (Convert.ToInt32(cc.Fees) * Convert.ToInt32(student_Course.Days));
                //  feemaster.TotalFees += Convert.ToInt32(student_Course.Fees);
                db.Entry(feemaster).State = EntityState.Modified;
                db.SaveChanges();
                TempData["Success"] = "Updated Successfully";
                ViewBag.CourseId    = new SelectList(db.Courses.Where(x => x.franchid == a), "CourseId", "CourseName");
                return(RedirectToAction("Index", new { roll = rollno }));
            }
            return(View(student_Course));
        }
Ejemplo n.º 8
0
        public ActionResult OTPVerifications([Bind(Include = "id,Name,Mobile,Email")] Registeration Register, Helper help, string otpvalue, int?id)
        {
            try
            {
                Register = db.Registerations.FirstOrDefault(x => x.id == id);
                if (ModelState.IsValid)
                {
                    if (Register.OTP == Convert.ToInt32(otpvalue))
                    {
                        Register.OTPStatus       = "Verify";
                        db.Entry(Register).State = EntityState.Modified;
                        db.SaveChanges();
                        this.SetNotification("Thanks For Your Account Verification, Your Password Will Be Send On Your Email", Models.NotificationEnumeration.Success);
                        // Send Email for Password
                    }
                    else
                    {
                        this.SetNotification("Wrong OTP", Models.NotificationEnumeration.Success);
                    }
                }

                return(View());
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 9
0
        public ActionResult CreateBook([Bind(Include = "Mid,IdCard,Bid,IssueDate,LastDate,Fine,Status")] IssueBook books, int bookid)
        {
            if (ModelState.IsValid)
            {
                Books   book = db.Books.Find(bookid);
                Setting ss   = db.Settings.First();
                if (book.BookCopies > ss.BookAlert)
                {
                    books.Bid    = bookid;
                    books.Status = "Issue";
                    books.fine   = 0;
                    db.IssueBooks.Add(books);
                    db.SaveChanges();
                    #region Update Book Quantity

                    book.BookCopies = book.BookCopies - 1;

                    db.Entry(book).State = EntityState.Modified;
                    db.SaveChangesAsync();
                    #endregion
                    TempData["Success"] = "Issue Book Successfully";
                }
                else
                {
                    TempData["Success"] = "Quantity Not Sufficient";
                    return(RedirectToAction("add", new { id = books.Mid }));
                }
            }
            return(RedirectToAction("add", new { id = books.Mid }));
        }
Ejemplo n.º 10
0
        public async Task <ActionResult> Edit([Bind(Include = "id,SerialNo,StudentName,FatherName,MotherName,Religion,Address,ContactNo,Email,Nationality,Dateofbirth,BirthCertificate,Passport,NationalId,Ielts,Sat,Tofel,Gre,PrefCountry,PrefCollege,PrefSubject,Sponsorship,SponsorshipType,RefferedName,Comments")] PreForm preForm, Helper help)
        {
            if (ModelState.IsValid)
            {
                preForm.ActivationCode  = activationCode.ToString();
                db.Entry(preForm).State = EntityState.Modified;
                await db.SaveChangesAsync();

                // Send Confirm Email Address
                //   SendActivationEmail(preForm.Email);
                // var url = string.Format("{ 0}://{1}/PreForms/Activation/{2}", Request.Url.Scheme, Request.Url.Authority, activationCode);
                if (preForm.Email != null)
                {
                    var temp = db.EmailTemplates.FirstOrDefault(x => x.id == 1);
                    if (temp != null)
                    {
                        string body = help.PopulateBody("Official Visa", "Verify Email", "", temp.Template);
                        help.SendHtmlFormattedEmail(preForm.Email, temp.Title, body);
                    }
                    else
                    {
                        this.SetNotification("Enter The Email Address For Get More Updates", NotificationEnumeration.Warning);
                    }
                }
                return(RedirectToAction("Index"));
            }

            return(View(preForm));
        }
        //public ActionResult InsertOffer(Offerletter off,int country,int college,int course)
        //{

        //    off.Cid = country;
        //    off.Oid = college;
        //    off.CCid = course;
        //    db.Offerletter.Add(off);
        //    db.SaveChanges();
        //    TempData["Success"] = "Offerletter Detail Successfully";
        //    return View();
        //}

        public JsonResult Payment(Helper Help, ApplicationRecipt Recipt, Leader ll, Helper help)
        {
            using (var transaction = db.Database.BeginTransaction())
            {
                try
                {
                    // Recipt.Date = System.DateTime.Now;
                    var    inquiryid = db.Applications.FirstOrDefault(x => x.ApplicationNo == Recipt.ApplicationNo).InquiryId;
                    online onlines   = db.onlines.FirstOrDefault(x => x.inquiryid == inquiryid);
                    string franchise = Help.Consoller();
                    // Recipt.ApplicationNo = Emp.ApplicationNo;
                    Recipt.Leadger = db.Ledgers.FirstOrDefault(x => x.ApplicationNo == Recipt.ApplicationNo && x.Franchid == franchise).LeaderNo;

                    Recipt.ReciptNo = Help.recipt();

                    Recipt.RecivedBy = Help.Teacher();
                    Recipt.Date      = System.DateTime.Now;
                    db.ApplicationRecipts.Add(Recipt);
                    db.SaveChanges();
                    ll = db.Ledgers.FirstOrDefault(x => x.ApplicationNo == Recipt.ApplicationNo);
                    if (ll != null)
                    {
                        int recived = ll.Received;
                        ll.Received        = recived + Recipt.Amount;
                        db.Entry(ll).State = EntityState.Modified;
                        db.SaveChanges();
                    }
                    Process pr = db.Process.FirstOrDefault(x => x.ApplicationNo == Recipt.ApplicationNo);
                    if (pr.Offerletter == false)
                    {
                        var Process = db.Process.SingleOrDefault(x => x.ApplicationNo == Recipt.ApplicationNo);
                        if (Process != null)
                        {
                            Process.Offerletter = true;

                            db.SaveChanges();
                        }
                    }
                    if (Recipt.sms == true)
                    {
                        help.sendsms(onlines.Mobile, "Hello," + onlines.Name + " Thank you For Deposit  ");
                    }
                    transaction.Commit();
                    return(Json(Recipt, JsonRequestBehavior.AllowGet));
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
        public async Task <ActionResult> Edit([Bind(Include = "REGId,Session,Type,AddmissionNumber,RollNumber,CID,SCID,FirstName,LastName,Gender,DOB,CatID,Mobile,Email,AdmissionDate,Image,FatherName,FatherPhone,FatherOccupation,MotherName,MotherPhone,MotherOccupation,CurrentAddress,ParmanentAddress,AadharNumber,TID,SpecialCase,Remarks")] Registration registration)
        {
            if (ModelState.IsValid)
            {
                db.Entry(registration).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.CatID = new SelectList(db.CatDatas, "CatID", "CategoryName", registration.CatID);
            ViewBag.CID   = new SelectList(db.SchoolClasses, "CID", "ClassName", registration.CID);
            ViewBag.SCID  = new SelectList(db.Sections, "SCID", "SectionName", registration.SCID);
            ViewBag.TID   = new SelectList(db.TransportCharges, "TID", "AreaName", registration.TID);
            return(View(registration));
        }
Ejemplo n.º 13
0
        public IHttpActionResult PutPartyInfo(int id, PartyInfo partyInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != partyInfo.PartyInfoId)
            {
                return(BadRequest());
            }

            db.Entry(partyInfo).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PartyInfoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        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));
        }
Ejemplo n.º 15
0
        public async Task <ActionResult> Edit([Bind(Include = "id,Name,Description,Image")] slider slider, HttpPostedFileBase file, Helper Help)
        {
            if (ModelState.IsValid)
            {
                slider.Image = file != null?Help.uploadfile(file) : img;

                #region delete file
                string fullPath = Request.MapPath("~/UploadedFiles/" + img);
                if (img == slider.Image)
                {
                }
                else
                {
                    if (System.IO.File.Exists(fullPath))
                    {
                        System.IO.File.Delete(fullPath);
                    }
                }
                #endregion

                db.Entry(slider).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(slider));
        }
        public ActionResult Edit([Bind(Include = "Clientid,Name,Image,date")] Clientlogo clientlogo, HttpPostedFileBase file, Helper Help)
        {
            if (ModelState.IsValid)
            {
                clientlogo.date  = System.DateTime.Now;
                clientlogo.Image = file != null?Help.uploadfile(file) : img;

                #region delete file
                string fullPath = Request.MapPath("~/UploadedFiles/" + img);
                if (img == clientlogo.Image)
                {
                }
                else
                {
                    if (System.IO.File.Exists(fullPath))
                    {
                        System.IO.File.Delete(fullPath);
                    }
                }
                #endregion
                db.Entry(clientlogo).State = EntityState.Modified;
                db.SaveChanges();
                TempData["Success"] = "Updated Successfully";
                return(RedirectToAction("Index"));
            }
            return(View(clientlogo));
        }
Ejemplo n.º 17
0
        public ActionResult Edit([Bind(Include = "Studentid,Name,FatherName,Mobile,Email,Gender,DOB,Image,Address,Qualification,CourseType,RollNo,JoiningDate,UserName,Password,date,Status")] StudentDetail studentDetail, HttpPostedFileBase file, Helper Help)
        {
            if (ModelState.IsValid)
            {
                studentDetail.date  = System.DateTime.Now;
                studentDetail.Image = file != null?Help.uploadfile(file) : img;

                #region delete file
                string fullPath = Request.MapPath("~/UploadedFiles/" + img);
                if (img == studentDetail.Image)
                {
                }
                else
                {
                    if (System.IO.File.Exists(fullPath))
                    {
                        System.IO.File.Delete(fullPath);
                    }
                }
                #endregion
                db.Entry(studentDetail).State = EntityState.Modified;
                db.SaveChanges();
                TempData["Success"] = "Updated Successfully";
                return(RedirectToAction("Index"));
            }
            return(View(studentDetail));
        }
Ejemplo n.º 18
0
        public ActionResult Edit([Bind(Include = "Achieverid,Name,ShortDescription,Image,Course,date,Reading,Writing,Listening,Speaking,Overall")] Achievers achievers, HttpPostedFileBase file, Helper Help)
        {
            if (ModelState.IsValid)
            {
                achievers.date  = System.DateTime.Now;
                achievers.Image = file != null?Help.uploadfile(file) : img;

                #region delete file
                string fullPath = Request.MapPath("~/UploadedFiles/" + img);
                if (img == achievers.Image)
                {
                }
                else
                {
                    if (System.IO.File.Exists(fullPath))
                    {
                        System.IO.File.Delete(fullPath);
                    }
                }
                #endregion
                db.Entry(achievers).State = EntityState.Modified;
                db.SaveChanges();
                TempData["Success"] = "Updated Successfully";
                return(RedirectToAction("Index"));
            }
            return(View(achievers));
        }
Ejemplo n.º 19
0
        public ActionResult Edit([Bind(Include = "Ieltsid,Name,Categoryid,TestType,Image,Url,Audio,date")] IeltsTest ieltsTest, HttpPostedFileBase file, Helper Help)
        {
            if (ModelState.IsValid)
            {
                ieltsTest.date  = System.DateTime.Now;
                ieltsTest.Image = file != null?Help.uploadfile(file) : img;

                #region delete file
                string fullPath = Request.MapPath("~/UploadedFiles/" + img);
                if (img == ieltsTest.Image)
                {
                }
                else
                {
                    if (System.IO.File.Exists(fullPath))
                    {
                        System.IO.File.Delete(fullPath);
                    }
                }
                #endregion
                db.Entry(ieltsTest).State = EntityState.Modified;
                db.SaveChanges();
                TempData["Success"] = "Updated Successfully";
                return(RedirectToAction("Index"));
            }
            ViewBag.Categoryid = new SelectList(db.Categories, "Categoryid", "Name", ieltsTest.Categoryid);
            return(View(ieltsTest));
        }
        public ActionResult Edit([Bind(Include = "Singleid,Serviceid,Name,Description,Image,date,Keyword,MetaDescription")] SingleService singleService, HttpPostedFileBase file, Helper Help)
        {
            if (ModelState.IsValid)
            {
                singleService.date  = System.DateTime.Now;
                singleService.Image = file != null?Help.uploadfile(file) : img;

                #region delete file
                string fullPath = Request.MapPath("~/UploadedFiles/" + img);
                if (img == singleService.Image)
                {
                }
                else
                {
                    if (System.IO.File.Exists(fullPath))
                    {
                        System.IO.File.Delete(fullPath);
                    }
                }
                #endregion
                db.Entry(singleService).State = EntityState.Modified;
                db.SaveChanges();
                TempData["Success"] = "Updated Successfully";
                return(RedirectToAction("Index"));
            }
            ViewBag.Serviceid = new SelectList(db.Services, "Serviceid", "Name", singleService.Serviceid);
            return(View(singleService));
        }
Ejemplo n.º 21
0
        public IHttpActionResult PutDestination(int id, Destination destination)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != destination.DestinationId)
            {
                return(BadRequest());
            }

            db.Entry(destination).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DestinationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult Edit([Bind(Include = "Id,date,name,email,contact,login,password,rid,image,Type,status,StartTime,EndTime")] tblreceptionist tblreceptionist, HttpPostedFileBase file, Helper Help)
        {
            if (ModelState.IsValid)
            {
                tblreceptionist.image = file != null?Help.uploadfile(file) : img;

                #region delete file
                string fullPath = Request.MapPath("~/UploadedFiles/" + img);
                if (img == tblreceptionist.image)
                {
                }
                else
                {
                    if (System.IO.File.Exists(fullPath))
                    {
                        System.IO.File.Delete(fullPath);
                    }
                }
                #endregion
                db.Entry(tblreceptionist).State = EntityState.Modified;
                db.SaveChanges();
                TempData["Success"] = "Updated Successfully";
                return(RedirectToAction("Index"));
            }
            return(View(tblreceptionist));
        }
        public ActionResult ApplyOfferletters(Offerletter off, Helper Help)
        {
            using (var transaction = db.Database.BeginTransaction())
            {
                try
                {
                    db.Entry(off).State = EntityState.Modified;
                    db.SaveChanges();

                    Process pr = db.Process.SingleOrDefault(x => x.ApplicationNo == off.ApplicationNo);
                    if (pr != null)
                    {
                        pr.Offerletter = true;
                        db.SaveChanges();
                    }
                    var inquiry = db.Applications.FirstOrDefault(x => x.ApplicationNo == off.ApplicationNo).InquiryId;
                    transaction.Commit();
                    if (off.Sms == true)
                    {
                        Help.sendsms(Help.contact(off.ApplicationNo), "Dear, Hello Your Offerletter has been Applied");
                    }
                    return(RedirectToAction("Dashboard", "Processing", new { id = off.ApplicationNo }));
                }
                catch (Exception)
                {
                    transaction.Rollback();
                    throw;
                }
            }
        }
Ejemplo n.º 24
0
        public ActionResult PutRateInfo(int id, RateInfo rateInfo)
        {
            if (!ModelState.IsValid)
            {
                return(Json("Model is not valid", JsonRequestBehavior.AllowGet));
            }

            if (id != rateInfo.RateInfoId)
            {
                return(Json("Model id is not valid", JsonRequestBehavior.AllowGet));
            }

            db.Entry(rateInfo).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RateInfoExists(id))
                {
                    return(Json("Data is not in table", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    throw;
                }
            }

            return(Json(rateInfo, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Edit([Bind(Include = "Id,name,dob,fathername,address,phone,fatherphn,language,board,qualification,coaching,institutename,type,refferedby,image,uid,Status,username,password,gender,remarks,email,discount,date")] tblstudentdata tblstudentdata, HttpPostedFileBase file, Helper Help)
        {
            if (ModelState.IsValid)
            {
                tblstudentdata.image = file != null?Help.uploadfile(file) : img;

                #region delete file
                string fullPath = Request.MapPath("~/UploadedFiles/" + img);
                if (img == tblstudentdata.image)
                {
                }
                else
                {
                    if (System.IO.File.Exists(fullPath))
                    {
                        System.IO.File.Delete(fullPath);
                    }
                }
                #endregion
                db.Entry(tblstudentdata).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(tblstudentdata));
        }
Ejemplo n.º 26
0
        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());
        }
Ejemplo n.º 27
0
        public ActionResult Edit([Bind(Include = "id,name,phone,email,address,logo")] tbldetail tbldetail, HttpPostedFileBase file, Helper Help)
        {
            if (ModelState.IsValid)
            {
                tbldetail.logo = file != null?Help.uploadfile(file) : img;

                #region delete file
                string fullPath = Request.MapPath("~/UploadedFiles/" + img);
                if (img == tbldetail.logo)
                {
                }
                else
                {
                    if (System.IO.File.Exists(fullPath))
                    {
                        System.IO.File.Delete(fullPath);
                    }
                }
                #endregion
                db.Entry(tbldetail).State = EntityState.Modified;
                db.SaveChanges();
                TempData["Success"] = "Updated Successfully";
                return(RedirectToAction("Index"));
            }
            return(View(tbldetail));
        }
Ejemplo n.º 28
0
        public ActionResult Edit([Bind(Include = "Newsid,Name,Description,ShortDescription,Image,Thumbnail,date")] news news, HttpPostedFileBase file, Helper Help)
        {
            if (ModelState.IsValid)
            {
                news.date  = System.DateTime.Now;
                news.Image = file != null?Help.uploadfile(file) : img;

                #region delete file
                string fullPath = Request.MapPath("~/UploadedFiles/" + img);
                if (img == news.Image)
                {
                }
                else
                {
                    if (System.IO.File.Exists(fullPath))
                    {
                        System.IO.File.Delete(fullPath);
                    }
                }
                #endregion
                news.Thumbnail = file != null?Help.uploadfile(file) : thumb;

                db.Entry(news).State = EntityState.Modified;
                db.SaveChanges();
                TempData["Success"] = "Updated Successfully";
                return(RedirectToAction("Index"));
            }
            return(View(news));
        }
        public async Task <ActionResult> Edit([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
                {
                    db.Entry(collegeCourse).State = EntityState.Modified;
                    await db.SaveChangesAsync();

                    //       return RedirectToAction("Index");

                    db.Intakes.RemoveRange(db.Intakes.Where(x => x.CCid == collegeCourse.Code));
                    db.SaveChanges();
                    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(View(collegeCourse));
                }
                catch (Exception)
                {
                    transaction.Rollback();
                    throw;
                }
            }
        }
Ejemplo n.º 30
0
 public ActionResult Edit([Bind(Include = "RoomId,room,status")] tblroom tblroom)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblroom).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblroom));
 }