Esempio n. 1
0
 public void RemoveRelation(long relativeId)
 {
     CitizenBusinessLayer.RemoveRelation(User.Identity.GetUserId <long>(), relativeId, () => {
         if (!CitizenBusinessLayer.IsRelationConfirmed(User.Identity.GetUserId <long>(), relativeId))
         {
             NotificationsHub.NotifyRelative(relativeId, -1);
         }
     });
 }
Esempio n. 2
0
        public JsonResult AddRelative(long relativeId, string relationType)
        {
            int  relationId = (relationType == "Parent") ? 1 : (relationType == "Friend") ? 3 : 4;
            long citizenId  = User.Identity.GetUserId <long>();

            try
            {
                CitizenBusinessLayer.AddRelative(citizenId, relativeId, relationId, () => NotificationsHub.NotifyRelative(relativeId, 1, CitizenBusinessLayer.GetCitizen(relativeId).Name, relationType));

                return(Json(new { Code = 0, Message = "Added Successfully" }));
            }
            catch (Exception e)
            {
                SqlException exception = e.InnerException.InnerException as SqlException;
                return(Json(new { Code = exception.Number, Message = exception.Message }));
            }
        }