public ActionResult DeleteConfirmed(int id)
        {
            Portfolio_CustomerRequest portfolio_CustomerRequest = db.Portfilio_CustomerRequest.FirstOrDefault(x => x.Id == id);

            portfolio_CustomerRequest.Status = "1";
            //  db.Portfilio_CustomerRequest.Remove(portfolio_CustomerRequest);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,C_Id,Type,FinishDate,Land,Housing,Office,Country,City,MinPrice,MaxPrice,MinArea,MaxArea,FloorChange,Transformation,Note")] Portfolio_CustomerRequest portfolio_CustomerRequest)
 {
     if (ModelState.IsValid)
     {
         db.Entry(portfolio_CustomerRequest).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(portfolio_CustomerRequest));
 }
        // GET: Portfolio_CustomerRequest/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Portfolio_CustomerRequest portfolio_CustomerRequest = db.Portfilio_CustomerRequest.Find(id);

            if (portfolio_CustomerRequest == null)
            {
                return(HttpNotFound());
            }
            return(View(portfolio_CustomerRequest));
        }
        public ActionResult CustomerProcess(CustomerModelView customer)
        {
            if (ModelState.IsValid)
            {
                if (customer.Id == null)
                {
                    if (customer.c_Name == null && customer.c_Surname == null)
                    {
                        Portfolio_CustomerRequest pcus = new Portfolio_CustomerRequest();
                        pcus.City           = customer.cr_City;
                        pcus.Country        = customer.cr_Country;
                        pcus.FinishDate     = customer.cr_FinishDate;
                        pcus.C_Id           = customer.c_Id;
                        pcus.FloorChange    = customer.cr_FloorChange;
                        pcus.Housing        = customer.cr_Housing;
                        pcus.Land           = customer.cr_Land;
                        pcus.MaxArea        = customer.cr_MaxArea;
                        pcus.MinArea        = customer.cr_MinArea;
                        pcus.MaxPrice       = customer.cr_MaxPrice;
                        pcus.MinPrice       = customer.cr_MinPrice;
                        pcus.Note           = customer.cr_Note;
                        pcus.Status         = customer.cr_Status;
                        pcus.Office         = customer.cr_Office;
                        pcus.Transformation = customer.cr_Transformation;
                        db.Portfilio_CustomerRequest.Add(pcus);
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        Portfolio_Customer cus = new Portfolio_Customer();
                        cus.Name    = customer.c_Name;
                        cus.Surname = customer.c_Surname;
                        cus.EMail   = customer.c_EMail;
                        cus.Phone2  = customer.c_Phone2;
                        cus.Phone1  = customer.c_Phone1;
                        db.Portfolio_Customer.Add(cus);
                        db.SaveChanges();
                        var customerId =
                            db.Portfolio_Customer.Where(x => x.EMail == customer.c_EMail && x.Name == customer.c_Name &&
                                                        x.Surname == customer.c_Surname)
                            .Select(x => x.Id)
                            .FirstOrDefault();

                        Portfolio_CustomerRequest pcus = new Portfolio_CustomerRequest();
                        pcus.City           = customer.cr_City;
                        pcus.Country        = customer.cr_Country;
                        pcus.FinishDate     = customer.cr_FinishDate;
                        pcus.C_Id           = customerId;
                        pcus.FloorChange    = customer.cr_FloorChange;
                        pcus.Housing        = customer.cr_Housing;
                        pcus.Land           = customer.cr_Land;
                        pcus.MaxArea        = customer.cr_MaxArea;
                        pcus.MinArea        = customer.cr_MinArea;
                        pcus.MaxPrice       = customer.cr_MaxPrice;
                        pcus.MinPrice       = customer.cr_MinPrice;
                        pcus.Note           = customer.cr_Note;
                        pcus.Status         = customer.cr_Status;
                        pcus.Office         = customer.cr_Office;
                        pcus.Transformation = customer.cr_Transformation;
                        db.Portfilio_CustomerRequest.Add(pcus);
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }
                }
                else
                {
                    Portfolio_CustomerRequest pcus =
                        db.Portfilio_CustomerRequest.Where(x => x.Id == customer.Id).FirstOrDefault();
                    pcus.City           = customer.cr_City;
                    pcus.Country        = customer.cr_Country;
                    pcus.FinishDate     = customer.cr_FinishDate;
                    pcus.C_Id           = customer.c_Id;
                    pcus.FloorChange    = customer.cr_FloorChange;
                    pcus.Housing        = customer.cr_Housing;
                    pcus.Land           = customer.cr_Land;
                    pcus.MaxArea        = customer.cr_MaxArea;
                    pcus.MinArea        = customer.cr_MinArea;
                    pcus.MaxPrice       = customer.cr_MaxPrice;
                    pcus.MinPrice       = customer.cr_MinPrice;
                    pcus.Note           = customer.cr_Note;
                    pcus.Status         = customer.cr_Status;
                    pcus.Office         = customer.cr_Office;
                    pcus.Transformation = customer.cr_Transformation;

                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            AddItemDropDownList();
            return(View(customer));
        }