public async Task <ActionResult> Create(SavePacientViewModel savePacient)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var pacient = Mapper.Map <Pacient>(savePacient);
                    var user    = await _userManager.GetUserAsync(HttpContext.User);

                    await _userManager.RemoveFromRoleAsync(user, "Basic");

                    await _userManager.AddToRoleAsync(user, "Pacient");

                    pacient.UserId = user.Id;
                    _context.Pacient.Add(pacient);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction("Index", "Home"));
                }
                throw new Exception("Campos inválidos");
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Edit(Guid id, SavePacientViewModel savePacient)
        {
            try
            {
                if (id != savePacient.Id)
                {
                    return(BadRequest());
                }

                if (ModelState.IsValid)
                {
                    var pacient = Mapper.Map <Pacient>(savePacient);

                    _context.Pacient.Update(pacient);
                    _context.SaveChanges();

                    return(RedirectToAction("Index", "Home"));
                }
                throw new Exception("Campos inválidos");
            }
            catch
            {
                return(View());
            }
        }
        public async Task <ActionResult> Delete(Guid id, SavePacientViewModel savePacient)
        {
            try
            {
                if (id != savePacient.Id)
                {
                    return(BadRequest());
                }

                var pacient = await _context.Pacient.SingleOrDefaultAsync(c => c.Id == id);

                pacient.IsActive = false;
                _context.Pacient.Update(pacient);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index", "Home"));
            }
            catch
            {
                return(View());
            }
        }