Ejemplo n.º 1
0
        public IHttpActionResult PostApplicationStage(int appId, int stageId, ApplicationStageDO appStage)
        {
            using (var transaction = this.unitOfWork.BeginTransaction())
            {
                GvaApplicationStage applicationStage = this.unitOfWork.DbContext.Set<GvaApplicationStage>().Find(stageId);
                var stageTermDate = this.applicationStageRepository.GetApplicationTermDate(appId, appStage.StageId);

                if (applicationStage != null)
                {
                    applicationStage.GvaStageId = appStage.StageId;
                    applicationStage.StartingDate = appStage.Date;
                    applicationStage.InspectorLotId = appStage.InspectorId;
                    applicationStage.Ordinal = appStage.Ordinal;
                    applicationStage.Note = appStage.Note;
                    applicationStage.StageTermDate = stageTermDate;
                }

                this.unitOfWork.Save();

                transaction.Commit();

                return Ok(applicationStage);
            }
        }
Ejemplo n.º 2
0
        public IHttpActionResult PostNewApplicationStage(int appId, ApplicationStageDO appStage)
        {
            using (var transaction = this.unitOfWork.BeginTransaction())
            {
                var stageTermDate = this.applicationStageRepository.GetApplicationTermDate(appId, appStage.StageId);
                GvaStage gvaStage = this.unitOfWork.DbContext.Set<GvaStage>().Find(appStage.StageId);

                GvaApplicationStage stage = new GvaApplicationStage()
                {
                    GvaApplicationId = appId,
                    GvaStageId = gvaStage.GvaStageId,
                    StartingDate = appStage.Date,
                    InspectorLotId = appStage.InspectorId,
                    Ordinal = appStage.Ordinal,
                    Note = appStage.Note,
                    StageTermDate = stageTermDate
                };

                GvaApplicationStage applicationStage = this.unitOfWork.DbContext.Set<GvaApplicationStage>().Add(stage);

                this.unitOfWork.Save();

                transaction.Commit();

                return Ok(applicationStage);
            }
        }