Beispiel #1
0
 public async Task<ActionResult> New(PartnerViewModel model)
 {
     if (ModelState.IsValid)
     {
         var m = Mapper.Map<Partner>(model);
         var church = await this.CurrentChurchAdministered();
         if (church != null)
         {
             m.ChurchId = church.Id;
             m.DateCreated = DateTime.Now;
             _partnerService.Insert(m);
             base.AccessContext.FlushChanges();
             m.UniqueId = "P" + m.Id.ToString();
             //TODO, Send SMS And Or Email To the Partner with New Id
             return Json(new { });
         }
         ModelState.AddModelError("","You Must be Logged In as Church Admin Before you can add Partners");
     }
     return PartialView(model);
 }
Beispiel #2
0
 public PartialViewResult StageCreate(int id)
 {
     var s = _stagedPartnerService.GetSingle(id);
     if (s != null)
     {
         var m = new PartnerViewModel()
             {
                 CellId = s.CellId.HasValue ? s.CellId.Value : 0,
                 ChurchId = s.ChurchId.HasValue ? s.ChurchId.Value : 0,
                 DateCreated = s.DateCreated.HasValue ? s.DateCreated.Value : DateTime.Now,
                 Email = s.Email,
                 FirstName = s.FirstName,
                 Id = s.Id,
                 LastName = s.LastName,
                 PCFId = s.PCFId.HasValue ? s.PCFId.Value : 0,
                 Phone = s.Phone,
                 Title = s.Title,
                 UniqueId = s.UniqueId,
                 DateOfBirth = s.DateOfBirth.HasValue ? s.DateOfBirth.Value : DateTime.Now,
                 Gender = s.Gender
             };
         return PartialView(m);
     }
     return PartialView();
 }
Beispiel #3
0
        public ActionResult StageCreate(PartnerViewModel model)
        {
            if (ModelState.IsValid)
            {
                var m = Mapper.Map<Partner>(model);
                var church = this.CurrentChurchAdministered().Result;
                if (church != null) m.ChurchId = church.Id;

                _partnerService.Insert(m);
                base.AccessContext.FlushChanges();
                m.UniqueId = "P" + m.Id;
                _stagedPartnerService.Delete(model.Id);
                //TODO: Send Email and Or SMS with the Partners Id
                return Json(new {});
            }
            return PartialView(model);
        }
Beispiel #4
0
 public ActionResult Edit(PartnerViewModel model)
 {
     if (ModelState.IsValid)
     {
         var m = _partnerService.GetSingle(model.Id);
         if (m != null)
         {
             m.CellId = model.CellId;
             m.ChurchId = model.ChurchId;
             m.DateCreated = model.DateCreated;
             m.Email = model.Email;
             m.FirstName = model.FirstName;
             m.LastName = model.LastName;
             m.PCFId = model.PCFId;
             m.Phone = model.Phone;
             m.Title = model.Title;
             m.UniqueId = model.UniqueId;
             return Json(new {});
         }
     }
     return PartialView();
 }