public Covenant Update(Covenant Covenant)
 {
     DbEntityEntry entry = context.Entry(Covenant);
     entry.State = EntityState.Modified;
     context.SaveChanges();
     return Covenant;
 }
        public void CreateAInvalidcovenantBusinessTest()
        {
            Covenant covenant = new Covenant();
            covenant.Name = "Raul";

            Validator.Validate(covenant);
        }
        public Covenant Update(Covenant Covenant)
        {
            Validator.Validate(Covenant);

            var updatedCovenant = _CovenantRepository.Update(Covenant);

            return updatedCovenant;
        }
        public Covenant Create(Covenant Covenant)
        {
            Validator.Validate(Covenant);

            var savedCovenant = _CovenantRepository.Save(Covenant);

            return savedCovenant;
        }
        public void CreateAInvalidcovenantPlanTest()
        {
            Covenant covenant = new Covenant();
            covenant.Name = "Unimed";
            covenant.Business = "Teste";

            Validator.Validate(covenant);
        }
 public void CreateAInvalidCovenantCoverageTest()
 {
     Covenant covenant = new Covenant();
     covenant.Name = "Unimed";
     covenant.Business = "Ndd";
     covenant.Plan = "Pobre";
     covenant.Coverage = -1;
     Validator.Validate(covenant);
 }
Beispiel #7
0
        public static Covenant GetCovenant()
        {
            Covenant covenant = new Covenant();
            covenant.Name = "Unimed";
            covenant.Business = "NddDigital";
            covenant.Plan = "Plano ideal";
            covenant.Coverage = 80;

            return covenant;
        }
        public ActionResult Create(CreateViewCovenantModel modelView)
        {
            try
            {
                if (!ModelState.IsValid) return View();
                Covenant covenant = new Covenant();

                covenant.Name = modelView.Name;
                covenant.Business = modelView.Business;
                covenant.Plan = modelView.Plan;
                covenant.Coverage = modelView.Coverage;

                _service.Create(covenant);

                return RedirectToAction("Index");
            }
            catch
            {
                return View("Error");
            }
        }
 public Covenant Save(Covenant xonsultation)
 {
     var newCovenant = context.Covenants.Add(xonsultation);
     context.SaveChanges();
     return newCovenant;
 }
        public void CreateAInvalidCovenantNameTest()
        {
            Covenant covenant = new Covenant();

            Validator.Validate(covenant);
        }