public bool WithdrawApplication(Guid id)
        {
            try
            {
                Data.UnitApplicant application = db.UnitApplicants.Include("Applicant", "Unit").Single(f => f.Id == id);

                if (!CanEditApplication(this.permissions, application.Applicant.Id, application.Unit.Id))
                {
                    ThrowAuthError();
                }

                db.UnitApplicants.Remove(application);

                db.SaveChanges();

                // $TODO - if appropriate, clean up member?
                return(true);
            }
            catch (HttpResponseException)
            {
                throw;
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
            return(false);
        }
 internal static void RegisterApplication(Data.IKcsarContext db, Guid id, Data.Member member)
 {
     Data.UnitApplicant application = new Data.UnitApplicant
     {
         Unit      = db.Units.Single(f => f.Id == id),
         Applicant = member,
         Started   = DateTime.Now,
         IsActive  = true,
     };
     db.UnitApplicants.Add(application);
 }
Exemplo n.º 3
0
 internal static void RegisterApplication(Model.IKcsarContext db, Guid id, Model.Member member)
 {
     Model.UnitApplicant application = new Model.UnitApplicant
       {
     Unit = db.Units.Single(f => f.Id == id),
     Applicant = member,
     Started = DateTime.Now,
     IsActive = true,
       };
       db.UnitApplicants.Add(application);
 }