Example #1
0
        public void a5TestAddDelJobb()
        {
            var kund         = kundDb.GetAllKunder().FirstOrDefault(x => x.KundNamn == kundNamn);
            var jobb         = jobbDb.GetAllJobbs().FirstOrDefault(x => x.KundId == kund.Id);
            var delJobbModel = new DelJobbModel {
                StatusPåJobbet = DelJobbStatus.AttGöras.ToString(), JobbId = jobb.Id, Namn = "Deljob blabla", VemGör = "Erik"
            };

            delJobbDb.AddDelJobb(delJobbModel);
            Assert.AreEqual(1, delJobbDb.GetDelJobbsInJobb(jobb.Id).Count);
        }
        public void UpdateDelJobb(DelJobbViewModel viewModel)
        {
            var model = new DelJobbModel
            {
                Id             = viewModel.Id,
                AccessId       = viewModel.AccessId,
                StatusPåJobbet = viewModel.StatusPåJobbet.ToString(),
                JobbId         = viewModel.JobbId,
                Namn           = viewModel.Namn,
                VemGör         = viewModel.VemGör
            };

            delJobbDb.UpdateDelJobb(model);
        }
        public void AddDelJobb(DelJobbViewModel viewModel)
        {
            int index = 0;

            try
            {
                var lastJobIndex = delJobbDb.GetAllDelJobbs().LastOrDefault().AccessId;
                index = lastJobIndex + 1;
            }
            catch
            {
            }
            var model = new DelJobbModel
            {
                StatusPåJobbet = viewModel.StatusPåJobbet.ToString(),
                JobbId         = viewModel.JobbId,
                AccessId       = index,
                Namn           = viewModel.Namn,
                VemGör         = viewModel.VemGör,
                Kommentar      = viewModel.Kommentar
            };

            delJobbDb.AddDelJobb(model);
        }
Example #4
0
 public void UpdateDelJobb(DelJobbModel model)
 {
     UpdateProperty("Namn", model.Id, model.Namn);
     UpdateProperty("VemGör", model.Id, model.VemGör);
     UpdateProperty("StatusPåJobbet", model.Id, model.StatusPåJobbet.ToString());
 }
Example #5
0
 public void AddDelJobb(DelJobbModel model)
 {
     deljobbdb.InsertOne(model);
 }