Пример #1
0
        public static bool savedata(VMApplicant Applicant)
        {
            try
            {
                using (Model1 db = new Model1())
                {
                    TB_Applicant data = new TB_Applicant();
                    data.ID             = Applicant.ID;
                    data.Name           = Applicant.Name;
                    data.Email          = Applicant.Email;
                    data.Contact_Number = Applicant.Contact_Number;
                    data.Date_Of_Birth  = Applicant.Date_Of_Birth;
                    data.Address        = Applicant.Address;
                    data.Major          = Applicant.Major;
                    data.Question       = Applicant.Question;
                    data.Is_Delete      = false;
                    data.Created_By     = "System";
                    data.Created_On     = DateTime.Now;

                    db.TB_Applicant.Add(data);
                    db.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
        }
Пример #2
0
        public static bool Ubah(VMApplicant paramModel)
        {
            try
            {
                using (var db = new Model1())
                {
                    TB_Applicant a = db.TB_Applicant.Where(x => x.ID == paramModel.ID).FirstOrDefault();

                    if (a != null)
                    {
                        a.Name           = paramModel.Name;
                        a.Contact_Number = paramModel.Contact_Number;
                        a.Email          = paramModel.Email;
                        a.Date_Of_Birth  = paramModel.Date_Of_Birth;
                        a.Address        = paramModel.Address;
                        a.Major          = paramModel.Major;
                        a.Question       = paramModel.Question;
                        a.Modified_By    = paramModel.Modified_By;
                        a.Modified_On    = paramModel.Modified_On;

                        db.SaveChanges();
                    }
                }
            }
            catch (Exception)
            {
            }
            return(false);
        }
Пример #3
0
        public static string HapusData(long ID)

        {
            try
            {
                using (Model1 db = new Model1())
                {
                    TB_Applicant datalama = db.TB_Applicant.Where(a => a.ID == ID).FirstOrDefault();

                    datalama.Is_Delete = true;


                    db.SaveChanges();
                    return("ok");
                }
            }
            catch (Exception e)
            {
                return(e.Message.ToString());

                throw;
            }
        }