示例#1
0
        public void TestMethod1()
        {
            using (var ctx = new GuardianContext())
            {
                User u = new User();
                u.Email = "*****@*****.**";
                u.Name  = "VR";
                ctx.Users.Add(u);
                ctx.SaveChanges();

                Profile pr = new Profile();
                pr.User       = u;
                pr.RegionCode = "+91";
                ctx.Profiles.Add(pr);

                ctx.SaveChanges();
            }
        }
示例#2
0
        //ssm
        public async Task <bool> SaveMarshal(int groupID, long profileID, bool isValidated)
        {
            GroupMarshal grpMarshal = new GroupMarshal()
            {
                GroupID = groupID, ProfileID = profileID, IsValidated = isValidated
            };

            if (!isValidated)
            {
                grpMarshal.CreatedDate      = DateTime.UtcNow;
                grpMarshal.LastModifiedDate = DateTime.UtcNow;
                _guardianContext.GroupMarshals.Add(grpMarshal);
                _guardianContext.SaveChanges();
            }
            else
            {
                grpMarshal.LastModifiedDate = DateTime.UtcNow;
                _guardianContext.Entry <GroupMarshal>(grpMarshal).State = EntityState.Modified;
                _guardianContext.SaveChanges();
            }
            return(true);
        }
示例#3
0
 public void DeleteUsingEFTest()
 {
     using (var ctx = new GuardianContext())
     {
         //User u = new User() { Name = "VR" };//Not working
         User u = new User()
         {
             UserID = 2
         };                               // working
         ctx.Entry(u).State = EntityState.Deleted;
         ctx.SaveChanges();
     }
 }