Beispiel #1
0
        public ActionResult Edit(int id, TacheModel cm)
        {
            Tache c = new Tache();

            c           = cs.Get(t => t.id == id);
            c.dateDebut = cm.dateDebut;
            c.dateFin   = cm.dateFin;
            c.nom       = cm.nom;


            cs.Update(c);
            cs.Commit();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        // PUT: api/TacheAPI/5
        // [Route("api/updateTache")]
        public IHttpActionResult Put([FromBody] Tache value)
        {
            Tache tc = new Tache();

            // tc= ts.GetById(id);
            tc = ts.Get(x => x.IdTache == value.IdTache);
            tc.DeadlineTache  = value.DeadlineTache;
            tc.DescTache      = value.DescTache;
            tc.Nom            = value.Nom;
            tc.OragnisateurFk = value.OragnisateurFk;
            tc.EtatdeTache    = value.EtatdeTache;
            tc.IsDeleted      = value.IsDeleted;
            tc.OrgNom         = value.OrgNom;
            ts.Update(tc);
            ts.Commit();
            return(Ok());
        }
        public ActionResult IndexTache(TacheModelView model)
        {
            string strDDLValue = Request.Form["Id"].ToString();

            Os = new OrganizerService();
            Ts = new TacheService();
            try
            {
                //  MVCTutorialEntities db = new MVCTutorialEntities();
                // List<Department> list = db.Departments.ToList();
                var orgservice = Os.ListOrganizers();
                List <OrganizerModelView> lorg = new List <OrganizerModelView>();
                foreach (var item in orgservice)
                {
                    OrganizerModelView org = new OrganizerModelView();
                    org.Id        = item.Id;
                    org.FirstName = item.FirstName;
                    org.LastName  = item.LastName;

                    org.Password             = item.Password;
                    org.Email                = item.Email;
                    org.EmailConfirmed       = item.EmailConfirmed;
                    org.PasswordHash         = item.PasswordHash;
                    org.PhoneNumber          = item.PhoneNumber;
                    org.PhoneNumberConfirmed = item.PhoneNumberConfirmed;
                    org.TwoFactorEnabled     = item.TwoFactorEnabled;
                    org.LockoutEndDateUtc    = item.LockoutEndDateUtc;
                    org.LockoutEnabled       = item.LockoutEnabled;
                    org.AccessFailedCount    = item.AccessFailedCount;
                    org.UserName             = item.UserName;
                    // org.Roles = item.Roles;
                    org.SecurityStamp = item.SecurityStamp;

                    lorg.Add(org);
                }
                ViewData["Organ"]        = new SelectList(lorg, "Id", "FirstName");
                ViewBag.OrganisateurList = new SelectList(lorg, "Id", "FirstName");

                //{ EtatdeTache = (Domain.Entity.EtatTache)model.EtatdeTache, Nom = (Domain.Entity.NomTache)model.Nom };
                if (model.IdTache > 0)
                {
                    Tache t = new Tache();
                    t = Ts.Get(x => x.IdTache == model.IdTache);//&& x.IsDeleted==false);
                    //update
                    //Employee emp = db.Employees.SingleOrDefault(x => x.EmployeeId == model.EmployeeId && x.IsDeleted == false);
                    t.EtatdeTache    = (Domain.Entities.EtatTache)model.EtatdeTache;
                    t.Nom            = (Domain.Entities.NomTache)model.Nom;
                    t.OragnisateurFk = int.Parse(strDDLValue);
                    t.DescTache      = model.DescTache;
                    t.DeadlineTache  = model.DeadlineTache;
                    Ts.Update(t);
                }
                else
                {
                    //var client = new Client(creds: new Nexmo.Api.Request.Credentials
                    //{
                    //    ApiKey = "46703f47",
                    //    ApiSecret = "dzbFZkgQHi8FCzDz"
                    //});
                    //var results = client.SMS.Send(request: new SMS.SMSRequest
                    //{
                    //    from = "Nexmo",
                    //    to = "21628861641",
                    //    text = "You have a new task to do before : "+model.DeadlineTache
                    //});


                    Tache t = new Tache();
                    //Insert

                    t.EtatdeTache    = (Domain.Entities.EtatTache)model.EtatdeTache;
                    t.Nom            = (Domain.Entities.NomTache)model.Nom;
                    t.OragnisateurFk = int.Parse(strDDLValue);     //2;// model.OragnisateurFk;
                    t.DescTache      = model.DescTache;
                    t.DeadlineTache  = model.DeadlineTache;
                    t.IsDeleted      = false;
                    Ts.Add(t);
                    Ts.Commit();
                }
                return(View(model));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }