Esempio n. 1
0
    public async Task <NoteTaskDto> NewTask()
    {
        var taskEditor = new TaskEditorComponent(Store);

        taskEditor.AutoDBSave = false;  // don't save automatically

        await taskEditor.NewModel(Service);

        taskEditor.Model.NoteId = Model.NoteId;
        var userDto = (await Service.Users.GetByUserNameAsync(Store.AppUserName)).Entity;

        taskEditor.Model.UserId       = userDto.UserId;
        taskEditor.Model.UserFullName = userDto.FullName;
        taskEditor.Model.Description  = "(Task descripcion ...)";
        taskEditor.Model.StartDate    = DateTime.Now;
        taskEditor.Model.SetIsNew(true);

        var res = taskEditor.RunModal();

        if (res.Entity == EComponentResult.Executed)
        {
            Model.Tasks.Add(taskEditor.Model);
            return(taskEditor.Model);
        }
        else
        {
            return(null);
        }
    }
Esempio n. 2
0
    public NoteTaskDto EditTask(Guid taskId)
    {
        var taskEditor = new TaskEditorComponent(Store);

        taskEditor.AutoDBSave = false;  // don't save automatically

        var task = Model.Tasks.Where(_ => _.NoteTaskId == taskId).SingleOrDefault();

        taskEditor.LoadModel(Service, task, false);

        var res = taskEditor.RunModal();

        if (res.Entity == EComponentResult.Executed)
        {
            return(taskEditor.Model);
        }
        else
        {
            return(null);
        }
    }