Ejemplo n.º 1
0
        public void Create(ConsultingViewModel db)
        {
            var entity = new Consulting_Table();


            entity.ConsultingDate   = (DateTime)db.ConsultingDate.Date;
            entity.Beneficiaries_ID = db.Beneficiaries_ID;
            var q = entities.Beneficiaries_Table.Where(p => p.Beneficiaries_ID == db.Beneficiaries_ID).SingleOrDefault();

            db.BeneficiariesIDNumber = q.BeneficiariesIDNumber;

            db.BeneficiariesName    = q.BeneficiariesName;
            db.Gender               = q.Gender_Table.GenderName;
            entity.Area_ID          = db.Area_ID;
            entity.BeneficiariesAge = db.BeneficiariesAge;
            entity.Governorate_ID   = db.Governorate_ID;

            entity.CounselingRequired = HttpUtility.HtmlDecode(db.CounselingRequired);
            entity.CounselingRendered = HttpUtility.HtmlDecode(db.CounselingRendered);
            entity.CounselingStatus   = db.CounselingStatus;
            entity.TypeOfCaseID       = db.TypeOfCaseID;
            entity.IssuesTypeID       = db.IssuesTypeID;
            entity.ProjectID          = db.ProjectID;
            entity.UserID             = db.UserID;
            entities.Consulting_Table.Add(entity);
            entities.SaveChanges();

            db.ConsultingID = entity.ConsultingID;
        }
Ejemplo n.º 2
0
        public void Destroy(ConsultingViewModel db)
        {
            var entity = new Consulting_Table();

            entity.ConsultingID = db.ConsultingID;

            entities.Consulting_Table.Attach(entity);

            entities.Consulting_Table.Remove(entity);

            entities.SaveChanges();
        }
Ejemplo n.º 3
0
        public void Create(ConsultingViewModel db)
        {
            var entity = new Consulting_Table();

            entity.ConsultingNumber   = db.ConsultingNumber;
            entity.ConsultingDate     = (DateTime)db.ConsultingDate.Date;
            entity.ConsultantName     = db.ConsultantName;
            entity.CounselingRequired = HttpUtility.HtmlDecode(db.CounselingRequired);
            entity.CounselingRendered = HttpUtility.HtmlDecode(db.CounselingRendered);
            entity.ConsultingProvider = db.ConsultingProvider;
            entity.CounselingStatus   = db.CounselingStatus;
            entity.UserID             = db.UserID;
            entities.Consulting_Table.Add(entity);
            entities.SaveChanges();

            db.ConsultingID = entity.ConsultingID;
        }
Ejemplo n.º 4
0
        public void Update(ConsultingViewModel db)
        {
            var entity = new Consulting_Table();

            entity.ConsultingID = db.ConsultingID;

            entity.ConsultingNumber   = db.ConsultingNumber;
            entity.ConsultingDate     = (DateTime)db.ConsultingDate.Date;
            entity.ConsultantName     = db.ConsultantName;
            entity.CounselingRequired = HttpUtility.HtmlDecode(db.CounselingRequired);
            entity.CounselingRendered = HttpUtility.HtmlDecode(db.CounselingRendered);
            entity.CounselingStatus   = db.CounselingStatus;

            entity.CounselingStatus = db.CounselingStatus;
            entity.UserID           = db.UserID;
            entities.Consulting_Table.Attach(entity);
            entities.Entry(entity).State = EntityState.Modified;
            entities.SaveChanges();
        }