コード例 #1
0
        public SI_InventurenViewModel(int id)
        {
            db = new SteinbachEntities();
            if (id == 0)
            {
                Inventur = new SI_Inventuren();
                db.AddToSI_Inventuren(Inventur);
                Inventur.Inventurdatum = DateTime.Now;
            }
            else
            {
                Inventur = db.SI_Inventuren.Where(n => n.id == id).SingleOrDefault();
            }

            Mapper.CreateMap <SI_Inventuren, SI_InventurenViewModel>();
            //.ForMember(dest => dest.SI_Firma, opt => opt.Ignore())
            //.ForMember(dest => dest.SI_Person, opt => opt.Ignore());

            ////Mapper.AssertConfigurationIsValid();
            Mapper.Map <SI_Inventuren, SI_InventurenViewModel>(Inventur, this);
            Init();
            isDirty          = false;
            isBeendetEnabled = false;
            isGebuchtEnabled = false;
        }