/// <summary>
        /// Favorilerden cıkarılan kod paracaıs
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        // Favorilerden cıkarma
        public ActionResult RemoveFavorite(int id)
        {
            Favs removedFavs = _favServices.FindFav(id);

            _favServices.RemoveFav(removedFavs);
            return(View());
        }
Example #2
0
        public ActionResult Fav(int?ID)
        {
            using (var ctx = new Context())
            {
                Users tmp = (Users)Session["user"];
                Users usr = ctx.Users.Where(x => x.ID == tmp.ID).FirstOrDefault();

                var car = ctx.Cars.Where(x => x.ID == ID).FirstOrDefault();

                if (car != null && car.User.Mail != usr.Mail)
                {
                    Favs f = new Favs();
                    f.Car  = car;
                    f.User = usr;

                    ctx.Favs.Add(f);

                    ctx.SaveChanges();

                    return(RedirectToAction("Index", "Car", new { ID = car.ID }));
                }
            }

            return(RedirectToAction("Index", "Home"));
        }
Example #3
0
 public void AddToFav(Favs favs)
 {
     if (favs != null)
     {
         _unitOfWork.FavsDal.Add(favs);
         _unitOfWork.Complete();
     }
 }
Example #4
0
    // Use this for initialization
    void Start()
    {
        AppSoftware     = GameObject.Find("Applications");
        HackingSoftware = GameObject.Find("Hacking");
        SysSoftware     = GameObject.Find("System");
        //Computer = GameObject.Find("Computer");

        //System
        clk    = SysSoftware.GetComponent <Clock>();
        defalt = SysSoftware.GetComponent <Defalt>();
        am     = SysSoftware.GetComponent <AppMenu>();
        cmd    = SysSoftware.GetComponent <CLI>();
        com    = SysSoftware.GetComponent <Computer>();
        sc     = SysSoftware.GetComponent <SoundControl>();
        appman = SysSoftware.GetComponent <AppMan>();
        boot   = SysSoftware.GetComponent <Boot>();
        post   = SysSoftware.GetComponent <POST>();
        os     = SysSoftware.GetComponent <OS>();
        mouse  = SysSoftware.GetComponent <Mouse>();
        desk   = SysSoftware.GetComponent <Desktop>();

        //Applications
        al = AppSoftware.GetComponent <AccLog>();
        sm = AppSoftware.GetComponent <SystemMap>();
        ib = AppSoftware.GetComponent <InternetBrowser>();

        //Hacking
        prog  = HackingSoftware.GetComponent <Progtive>();
        trace = HackingSoftware.GetComponent <Tracer>();
        cy    = HackingSoftware.GetComponent <Descy>();
        ds    = HackingSoftware.GetComponent <DirSearch>();

        mb    = GetComponent <MissionBrow>();
        cc    = GetComponent <CurContracts>();
        sl    = GetComponent <SiteList>();
        note  = GetComponent <Notepad>();
        fav   = GetComponent <Favs>();
        tv    = GetComponent <TreeView>();
        mPass = GetComponent <MonitorBypass>();
        wsv   = GetComponent <WebSecViewer>();
        sdp   = GetComponent <ShutdownProm>();
        Audio = GetComponent <AudioSource>();

        windowRect.x = Customize.cust.windowx[windowID];
        windowRect.y = Customize.cust.windowy[windowID];

        Audio.volume = Customize.cust.Volume;
        DesktopY     = -50;
        StartTime    = 0.030f;
        Snap         = false;

        if (Size == 0)
        {
            Size = 21;
        }
    }
        /// <summary>
        /// Favorilere ekleyen kod parcası
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        // Favorilere ekleme
        public ActionResult AddToFavorite(int id)
        {
            // find product
            Product  product       = _productServices.GetProductById(id);
            Customer loginCustomer = Session["loginCustomer"] as Customer;
            Favs     favs          = new Favs()
            {
                CustomerId   = loginCustomer.CustomerId,
                ProductId    = product.ProductId,
                CreatedDate  = DateTime.Now,
                RemovedDate  = DateTime.Now,
                ModifiedDate = DateTime.Now
            };

            _favServices.AddToFav(favs);
            return(RedirectToAction("GetProduct", "Product"));
        }
        public ActionResult New(int?ID, string nowe)
        {
            using (var ctx = new Context())
            {
                Users tmp = (Users)Session["user"];
                Users usr = ctx.Users.Where(x => x.ID == tmp.ID).FirstOrDefault();

                Conversations c = new Conversations
                {
                    Buyer = usr,
                    Car   = ctx.Cars.Where(x => x.ID == ID).FirstOrDefault(),
                    New   = true
                };
                c.Count++;

                ctx.Conversations.Add(c);

                Messages m = new Messages
                {
                    Message = nowe,
                    Who     = false,
                    Conv    = c
                };

                ctx.Messages.Add(m);

                var favs = ctx.Favs.Where(x => x.Car.ID == c.Car.ID && x.User.ID == usr.ID).FirstOrDefault();

                if (favs == null)
                {
                    Favs f = new Favs
                    {
                        Car  = c.Car,
                        User = usr
                    };

                    ctx.Favs.Add(f);
                }

                ctx.SaveChanges();
            }

            return(RedirectToAction("Index", "Conv", new { ID = ID }));
        }
Example #7
0
 public void RemoveFav(Favs favs)
 {
     _unitOfWork.FavsDal.Remove(favs);
     _unitOfWork.Complete();
 }