コード例 #1
0
ファイル: InviteKeyService.cs プロジェクト: Espi4U/WebAPI
        public BaseResponse AddInviteKey(InviteKeyRequest request)
        {
            return(GetResponse(() => {
                var response = new BaseResponse();
                try
                {
                    using (FamilyFinanceContext db = new FamilyFinanceContext())
                    {
                        var family = db.Families.Where(x => x.Id == request.FamilyId).FirstOrDefault();

                        var inviteKey = new InviteKey
                        {
                            Key = request.Key,
                            Family = family
                        };
                        db.InviteKeys.Add(inviteKey);
                        db.SaveChanges();
                    }
                }
                catch
                {
                    response.BaseIsSuccess = false;
                    response.BaseMessage = Constants.BAD_REQUEST;
                }

                return response;
            }));
        }
コード例 #2
0
        public PlayerBuilder ToObject(string json, InviteKey inviteKey)
        {
            PlayerBuilder builder = ToObject(json);

            builder.SetInviteKey(inviteKey);
            inviteKey.UserId = builder.Id;

            return(builder);
        }
コード例 #3
0
 public Police(
     int id,
     string username,
     InviteKey inviteKey,
     Location location,
     string status,
     List <Gadget.Gadget> gadgets,
     bool triggeredAlarm
     ) : base(id, username, inviteKey, location, status, gadgets, triggeredAlarm)
 {
 }
コード例 #4
0
ファイル: Thief.cs プロジェクト: imfi-jz/SOPROJ11Q-Mobile
 public Thief(
     int id,
     string username,
     InviteKey inviteKey,
     Location location,
     string status,
     List <Gadget.Gadget> gadgets,
     bool triggeredAlarm,
     string caughtAt
     ) : base(id, username, inviteKey, location, status, gadgets, triggeredAlarm)
 {
     CaughtAt = caughtAt;
 }
コード例 #5
0
 public PlayerBuilder SetInviteKey(InviteKey inviteKey)
 {
     InviteKey = inviteKey;
     return(this);
 }