示例#1
0
        public string Create(int Id, string Tax_name, string Tax_Percentage, string gender, string date)
        {
            demo_dbEntities db = new demo_dbEntities();
            string          msg;

            try
            {
                if (ModelState.IsValid)
                {
                    Tax_Enter Emp = new Tax_Enter();
                    Emp.Id             = Id;
                    Emp.Tax_name       = Tax_name;
                    Emp.Tax_Percentage = Tax_Percentage;
                    Emp.gender         = gender;
                    Emp.date           = date;
                    db.AddToTax_Enter(Emp);
                    db.SaveChanges();
                    msg = "Saved Successfully";
                }
                else
                {
                    msg = "Validation data not successfull";
                }
            }
            catch (Exception ex)
            {
                msg = "Error occured:" + ex.Message;
            }
            return(msg);
        }
示例#2
0
        public string Delete(int Id)
        {
            demo_dbEntities db  = new demo_dbEntities();
            Tax_Enter       Emp = db.Tax_Enter.First(em1 => em1.Id == Id);

            db.DeleteObject(Emp);
            db.SaveChanges();
            return("Deleted successfully");
        }