public void Create(DtoConnection conn)
        {
            Connection Econn = new Connection();

            Econn.CreatedDate = conn.CreatedDate;
            Econn.IsActive    = conn.IsActive;
            Econn.IsDeleted   = conn.IsDeleted;
            Econn.UserIdOne   = conn.UserIdOne;
            Econn.UserIdTwo   = conn.UserIdTwo;
            context.connections.Add(Econn);
            context.SaveChanges();
        }
Beispiel #2
0
        public IActionResult ProfilIndex(int id)
        {
            var result = UserM.GetDtoUserbyId(id);
            var owner  = UserM.GetDtoUser(User.Identity.Name);

            if (result == null)
            {
                return(RedirectToAction("Error", "Home"));
            }
            if (result.UserId == owner.UserId)
            {
                ViewBag.durum = "Profili Düzenle";
            }

            DtoConnection f1 = ConnM.getconnection1(result.UserId, owner.UserId);
            DtoConnection f2 = ConnM.getconnection2(result.UserId, owner.UserId);


            if (result.UserId != owner.UserId)
            {
                ViewBag.UserType = "Guest";
            }

            if (f1 == null && f2 == null)
            {
                ViewBag.NotFriends = "True";
            }
            if (f1 != null)
            {
                if (!f1.IsActive)
                {
                    ViewBag.NotFriends = "Pending";
                }
            }
            if (f2 != null)
            {
                if (!f2.IsActive)
                {
                    ViewBag.NotFriends = "Pending";
                }
            }

            PostuserModel model = new PostuserModel();

            model.User  = result;
            model.posts = UserM.sprofiltweet(id);
            return(View(model));
        }
Beispiel #3
0
        public void Create(DtoConnection entity)
        {
            var gelen = Mapper.Map <Connection>(entity);
            var sorgu = unit.Connectionrepo.GetFallowing(entity.TakipciId).Where(x => x.takipid == entity.takipid).Select(x => x.Isdeleted == true).Any();

            if (sorgu == true)
            {
                unit.Connectionrepo.updatestate(gelen);
                unit.Save();
            }
            else
            {
                unit.Connectionrepo.Create(gelen);
                unit.Save();
            }
        }
Beispiel #4
0
        public IActionResult AddFriend(string friend)
        {
            var friendresult = UserM.GetDtoUser(friend);

            var owneresult = UserM.GetDtoUser(User.Identity.Name);

            DtoConnection conn = new DtoConnection();

            conn.CreatedDate = DateTime.Now;
            conn.IsActive    = false;
            conn.IsDeleted   = false;
            conn.UserIdOne   = owneresult.UserId;
            conn.UserIdTwo   = friendresult.UserId;

            ConnM.Create(conn);
            return(Json(true));
        }
        public DtoConnection getconnection2(int userid, int friendid)
        {
            var result = context.connections.Where(x => x.UserIdOne == friendid && x.UserIdTwo == userid).FirstOrDefault();

            if (result == null)
            {
                return(null);
            }
            else
            {
                DtoConnection conn = new DtoConnection();
                conn.CreatedDate = result.CreatedDate;
                conn.IsActive    = result.IsActive;
                conn.IsDeleted   = result.IsDeleted;
                conn.UserIdOne   = result.UserIdOne;
                conn.UserIdTwo   = result.UserIdTwo;
                return(conn);
            }
        }
Beispiel #6
0
        public IActionResult AddConnection(DtoConnection conn)
        {
            connection.Create(conn);

            return(Json(true));
        }
Beispiel #7
0
 public void Update(DtoConnection entity)
 {
     throw new NotImplementedException();
 }