Example #1
0
        public async Task <bool> SavePersonActivity(string personId, string bioId, PersonActivity newact)
        {
            var bio = await _mgrFcc.GetPersonBiographyByPersonId(personId);

            if (bio == null)
            {
                bioId = await _mgrFcc.SetPersonBiography(new PersonBiography()
                {
                    Id            = bioId,
                    PersonId      = personId,
                    BiographyText = null
                });
            }

            var dbRec = await _mgrFcc.GetPersonActivity(newact.Id);

            if (dbRec == null)
            {
                newact.Id           = Guid.NewGuid().ToString();
                newact.IsActive     = true;
                newact.DateCreated  = DateTime.Now;
                newact.BiographyId  = bioId;
                newact.DateModified = DateTime.Now;
                return(!string.IsNullOrWhiteSpace(await _mgrFcc.SetPersonActivity(newact)));
            }

            dbRec.DateBegin    = newact.DateBegin;
            dbRec.HasBegun     = newact.HasBegun;
            dbRec.HasEnded     = newact.HasEnded;
            dbRec.DateEnd      = newact.DateEnd;
            dbRec.Activity     = newact.Activity;
            dbRec.ActivityType = newact.ActivityType;
            dbRec.DateModified = DateTime.Now;
            return(await _mgrFcc.UpdatePersonActivity(dbRec));
        }