public ActionResult DeleteConfirmed(long id)
        {
            RepairMechanic repairMechanic = db.RepairMechanics.Find(id);

            db.RepairMechanics.Remove(repairMechanic);
            db.SaveChanges();
            return(RedirectToAction("Index", "MyAccount"));
        }
        public ActionResult UpdateStatusFalse(long?id)
        {
            RepairMechanic forsale = db.RepairMechanics.Find(id);

            forsale.Status          = false;
            db.Entry(forsale).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("AddsManage", "MyAccount"));
        }
        // GET: RepairMechanics/Edit/5
        public ActionResult Edit(long?id)
        {
            ViewBag.rep = db.RCategory.ToList();
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RepairMechanic repairMechanic = db.RepairMechanics.Find(id);

            if (repairMechanic == null)
            {
                return(HttpNotFound());
            }
            return(View(repairMechanic));
        }
        public ActionResult Pay(long?prime, long?vid, long?id, string userid, string amnt)
        {
            RepairMechanic forsale = db.RepairMechanics.Find(id);
            DateTime       _date   = Convert.ToDateTime(DateTime.Now);

            _date = _date.AddDays(365);


            forsale.UserId = User.Identity.GetUserId();

            forsale.Status    = true;
            forsale.Date      = DateTime.Now;
            forsale.EndDate   = _date;
            forsale.StratDate = DateTime.Now;

            db.Entry(forsale).State = EntityState.Modified;
            db.SaveChanges();
            var            ids    = DateTime.Now.ToString("mmddyyyy");
            RazorpayClient client = new RazorpayClient(RazorPayConst.Api_Key, RazorPayConst.Key_Secret);
            Dictionary <string, object> options = new Dictionary <string, object>();

            options.Add("amount", amnt); // amount in the smallest currency unit
            options.Add("receipt", "order_id" + ids);
            options.Add("currency", "INR");
            options.Add("payment_capture", "1");
            Order order = client.Order.Create(options);

            List <Order> payments = client.Order.All();
            string       datas    = payments[0]["id"];

            ViewBag.receipt = datas;

            RazorPayPaymentDetails clients = new RazorPayPaymentDetails();

            clients.Amount          = Convert.ToDouble(amnt);
            clients.Currency        = "INR";
            clients.Captured        = "Paid";
            clients.RazorpayOrderId = ids;
            clients.MerchantOrderId = "vooq.com";
            clients.PaymentId       = User.Identity.GetUserId();
            clients.PaymentDate     = DateTime.Now;
            db.RazorPayPaymentDetails.Add(clients);
            db.SaveChanges();

            return(View());
        }
        // GET: RepairMechanics/Details/5
        public ActionResult Details(string id)
        {
            id = id == null ? "" : id;
            SqlParameter[] Parameters =
            {
                new SqlParameter("@RepairMechanicId", id.ToString())
            };
            ViewBag.data = db.Database.SqlQuery <RepairMechanicModel>(" [dbo].[spGetListingData_RepairMechanics_Details] @RepairMechanicId", Parameters).ToList();
            long           ids     = Convert.ToInt64(id);
            RepairMechanic forsale = db.RepairMechanics.Find(ids);

            forsale.Views           = forsale.Views + 1;
            db.Entry(forsale).State = EntityState.Modified;
            db.SaveChanges();

            return(View());
        }
        public ActionResult Edit([Bind(Include = "UserId,EndDate,status,StratDate,RepairMechanicId,VId,UserId,Title,RCategoryId,MobileNumber,LandPhone,Email,Description,Location,Image1,Image2,Image3,Date,Views,Status,YearsOfExperiance")] RepairMechanic repairMechanic, HttpPostedFileBase file1, HttpPostedFileBase file2, HttpPostedFileBase file3)
        {
            ViewBag.rep = db.RCategory.ToList();
            if (ModelState.IsValid)
            {
                if (file1 != null)
                {
                    //file1.SaveAs(HttpContext.Server.MapPath("~/Images/")+ file1.FileName);
                    //realEstate.Image1 = "/Images/"+file1.FileName;
                    string watermarkText = "© Vooqq.Com";

                    //Get the file name.
                    string fileName = Path.GetFileNameWithoutExtension(file1.FileName);

                    //Read the File into a Bitmap.
                    using (Bitmap bmp = new Bitmap(file1.InputStream, false))
                    {
                        using (Graphics grp = Graphics.FromImage(bmp))
                        {
                            //Set the Color of the Watermark text.
                            Brush brush = new SolidBrush(Color.DimGray);

                            //Set the Font and its size.
                            Font font = new System.Drawing.Font("Arial", 30, FontStyle.Bold, GraphicsUnit.Pixel);

                            //Determine the size of the Watermark text.
                            SizeF textSize = new SizeF();
                            textSize = grp.MeasureString(watermarkText, font);

                            //Position the text and draw it on the image.
                            Point position = new Point((bmp.Width - ((int)textSize.Width + 10)), (bmp.Height - ((int)textSize.Height + 10)));
                            grp.DrawString(watermarkText, font, brush, position);

                            using (MemoryStream memoryStream = new MemoryStream())
                            {
                                //Save the Watermarked image to the MemoryStream.
                                bmp.Save(HttpContext.Server.MapPath("~/Images/") + file1.FileName);
                                repairMechanic.Image1 = "/Images/" + file1.FileName;
                            }
                        }
                    }
                }
                else if (repairMechanic.Image1 != null)
                {
                }
                else
                {
                    repairMechanic.Image1 = "/Images/nullimage.jpg";
                }
                if (file2 != null)
                {
                    string watermarkText = "© Vooqq.Com";

                    //Get the file name.
                    string fileName = Path.GetFileNameWithoutExtension(file2.FileName);

                    //Read the File into a Bitmap.
                    using (Bitmap bmp = new Bitmap(file2.InputStream, false))
                    {
                        using (Graphics grp = Graphics.FromImage(bmp))
                        {
                            //Set the Color of the Watermark text.
                            Brush brush = new SolidBrush(Color.DimGray);

                            //Set the Font and its size.
                            Font font = new System.Drawing.Font("Arial", 30, FontStyle.Bold, GraphicsUnit.Pixel);

                            //Determine the size of the Watermark text.
                            SizeF textSize = new SizeF();
                            textSize = grp.MeasureString(watermarkText, font);

                            //Position the text and draw it on the image.
                            Point position = new Point((bmp.Width - ((int)textSize.Width + 10)), (bmp.Height - ((int)textSize.Height + 10)));
                            grp.DrawString(watermarkText, font, brush, position);

                            using (MemoryStream memoryStream = new MemoryStream())
                            {
                                //Save the Watermarked image to the MemoryStream.
                                bmp.Save(HttpContext.Server.MapPath("~/Images/") + file2.FileName);
                                repairMechanic.Image2 = "/Images/" + file2.FileName;
                            }
                        }
                    }
                }
                else if (repairMechanic.Image2 != null)
                {
                }
                else
                {
                    repairMechanic.Image2 = "/Images/nullimage.jpg";
                }
                if (file3 != null)
                {
                    string watermarkText = "© Vooqq.Com";

                    //Get the file name.
                    string fileName = Path.GetFileNameWithoutExtension(file3.FileName);

                    //Read the File into a Bitmap.
                    using (Bitmap bmp = new Bitmap(file3.InputStream, false))
                    {
                        using (Graphics grp = Graphics.FromImage(bmp))
                        {
                            //Set the Color of the Watermark text.
                            Brush brush = new SolidBrush(Color.DimGray);

                            //Set the Font and its size.
                            Font font = new System.Drawing.Font("Arial", 30, FontStyle.Bold, GraphicsUnit.Pixel);

                            //Determine the size of the Watermark text.
                            SizeF textSize = new SizeF();
                            textSize = grp.MeasureString(watermarkText, font);

                            //Position the text and draw it on the image.
                            Point position = new Point((bmp.Width - ((int)textSize.Width + 10)), (bmp.Height - ((int)textSize.Height + 10)));
                            grp.DrawString(watermarkText, font, brush, position);

                            using (MemoryStream memoryStream = new MemoryStream())
                            {
                                //Save the Watermarked image to the MemoryStream.
                                bmp.Save(HttpContext.Server.MapPath("~/Images/") + file3.FileName);
                                repairMechanic.Image3 = "/Images/" + file3.FileName;
                            }
                        }
                    }
                }
                else if (repairMechanic.Image3 != null)
                {
                }
                else
                {
                    repairMechanic.Image3 = "/Images/nullimage.jpg";
                }
                repairMechanic.Date            = DateTime.Now;
                db.Entry(repairMechanic).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", "MyAccount"));
            }
            return(View(repairMechanic));
        }