Exemple #1
0
        public ActionResult Create(ClientViewModel client)
        {
            if (ModelState.IsValid)
            {
                Client clientDb = new Client();
                clientDb.Id = client.Id;
                clientDb.Bloc = client.Loc;
                clientDb.Costs = client.Costs;
                clientDb.Date = client.Date;
                clientDb.D50 = client.D50;
                clientDb.D60 = client.D60;
                clientDb.D70 = client.D70;
                clientDb.D80 = client.D80;
                clientDb.D90 = client.D90;
                clientDb.D100 = client.D100;
                clientDb.D112 = client.D112;
                clientDb.D122 = client.D122;
                clientDb.D132 = client.D132;
                clientDb.ReceivedAmount = client.ReceivedAmount;

                db.Clients.Add(clientDb);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(client);
        }
Exemple #2
0
        private static ClientViewModel GetClientViewModel(Client client)
        {
            ClientViewModel clientViewModel = new ClientViewModel();
            clientViewModel.Id = client.Id;

            clientViewModel.Loc = client.Bloc;
            clientViewModel.Date = client.Date;
            clientViewModel.D50 = client.D50;
            clientViewModel.D60 = client.D60;
            clientViewModel.D70 = client.D70;
            clientViewModel.D80 = client.D80;
            clientViewModel.D90 = client.D90;
            clientViewModel.D100 = client.D100;
            clientViewModel.D112 = client.D112;
            clientViewModel.D122 = client.D122;
            clientViewModel.D132 = client.D132;
            clientViewModel.Costs = client.Costs;
            clientViewModel.ReceivedAmount = client.ReceivedAmount;
            return clientViewModel;
        }
Exemple #3
0
        public ActionResult Edit(ClientViewModel client)
        {
            if (ModelState.IsValid)
            {

                Client clientDb = db.Clients.Find(client.Id);
                clientDb.Bloc = client.Loc;
                clientDb.Id = client.Id;
                clientDb.Costs = client.Costs;
                clientDb.Date = client.Date;
                clientDb.D50 = client.D50;
                clientDb.D60 = client.D60;
                clientDb.D70 = client.D70;
                clientDb.D80 = client.D80;
                clientDb.D90 = client.D90;
                clientDb.D100 = client.D100;
                clientDb.D112 = client.D112;
                clientDb.D122 = client.D122;
                clientDb.D132 = client.D132;
                clientDb.ReceivedAmount = client.ReceivedAmount;

                db.Entry(clientDb).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(client);
        }