Exemple #1
0
 public void CreateOpportunity(Opportunity opportunity)
 {
     opportunity.Created = DateTime.UtcNow;
     //_uow.GrantRepo.FindById(opportunity.GrantId).Opportunities.Add(opportunity);
     _uow.OpportunitiesRepo.Add(opportunity);
     _uow.Commit();
 }
Exemple #2
0
 public static Application NewApplication(Opportunity opportunity)
 {
     return new Application()
     {
         Id = Guid.NewGuid(),
         Opportunity = opportunity,
         Status = ApplicationStatus.Creating
     };
 }
Exemple #3
0
        public ActionResult CreateOpportunity(Guid grantId, Opportunity opportunity)
        {
            try
            {
                // TODO: Add update logic here
                if (ModelState.IsValid)
                {
                    //opp.GrantId = grantId;
                    _svc.AddOpportunityToGrand(grantId, opportunity);
                }

                return RedirectToAction("Details", "Grants", new { Id = grantId });
            }
            catch
            {
                return View();
            }
        }
        public ActionResult Create(Opportunity opportunity)
        {
            try
            {
                // TODO: Add insert logic here
                if (ModelState.IsValid)
                    _svc.CreateOpportunity(opportunity);

                return RedirectToAction("Index");
            }
            catch
            {
                var grants = _svc.GetAvailableGrants();
                var classifications = _svc.GetClassifications();

                var vm = new OpportunityBindingModel(opportunity, grants, classifications);
                return View(vm);
            }
        }
        public ActionResult Edit(Guid id, Opportunity opportunity)
        {
            try
            {
                // TODO: Add update logic here
                if (ModelState.IsValid)
                    _svc.PutOpportunityById(id, opportunity);
                return RedirectToAction("Index");
            }
            catch
            {
                var grants = _svc.GetAvailableGrants();
                var classifications = _svc.GetClassifications();

                var vm = new OpportunityBindingModel(opportunity, grants, classifications);
                return View(vm);
            }
        }
Exemple #6
0
 public void AddOpportunityToGrand(Guid grantId, Opportunity opp)
 {
     var grant = _uow.GrantRepo.FindById(grantId);
     grant.Opportunities.Add(opp);
     _uow.Commit();
 }
Exemple #7
0
 public void PutOpportunityById(Guid id, Opportunity o)
 {
     var item = _uow.OpportunitiesRepo.FindById(id);
     item.Name = o.Name;
     item.Description = o.Description;
     item.MaxDuration = o.MaxDuration;
     item.EstimateTotal = o.EstimateTotal;
     item.AwardCeiling = o.AwardCeiling;
     item.AwardFloor = o.AwardFloor;
     item.StartDate = o.StartDate;
     item.Deadline = o.Deadline;
     item.GrantId = o.GrantId;
     item.LastUpdated = DateTime.UtcNow;
     _uow.Commit();
 }